Oct-23-2018, 12:23 AM
New to Python.
Need to loop through query results like
col1,col2
---------
'' , 123
'' , 23
'' , 200
'a' , 33
'a' , 1
'b' , 0
'b' , 1
'c' , 2.
How do you do something like this "pseudo code"
Need to loop through query results like
col1,col2
---------
'' , 123
'' , 23
'' , 200
'a' , 33
'a' , 1
'b' , 0
'b' , 1
'c' , 2.
How do you do something like this "pseudo code"
while (not at end of rows) col=col1 while (col=col1 and not at end of rows) do something go to next row endwhile endwhileAm doing this now, but it doesn't depend on the value of col1
thecursor.execute(thequerystring) queryvalues=thecursor.fetchall() count=0 if (len(queryvalues)>0): for row in queryvalues: count=count+1 dosomething()