[Tutor] Question on a select statement with ODBC

Peter Otten __peter__ at web.de
Thu Oct 23 13:14:25 CEST 2014


Al Bull wrote:

> Quick question then...
> 
> Does this do the trick?

I may have misunderstood your original question; do you want to delete 
records from the database or from the Python list? Your code below will do 
the latter, once you have fixed the bugs. 

> Currentrecord = 1
> 
> While currentrecord <= len(ord_rows):
>       if savedbasub == currentrecord.ord_dbasub:
>           ord_rows.remove(currentrecord)
>          delcount += 1      
>    else:
>       savedbasub = currentrecord.ord_dbasub
>      currentrecord =+ 1 

As the general idea is correct I'll encourage you to try to fix these bugs 
yourself. The first thing you have to resolve: is currentrecord an index or 
an object representing a database row?



More information about the Tutor mailing list