python & mysql probelm

james blair talktojamesblair at yahoo.com
Fri Mar 26 16:11:08 EST 2004


Hi
I am having a problem executing following query:
cursor.execute("select * from projects where projectid between '%s'
and '%s'"%(id1,id2))
But say if i have projectid's from 1 to 20 in database & if i give the
project range 1 to 2 then it gives me the result 1,2,11,12,13,14.....
When I execute this query in mysql i.e
select * from projects where projectid between 1 and 2,I get the
correct result.
I also tried doing 
cursor.execute("select * from projects where projectid between '%s'
and '%s'"%(int(id1),int(id2))
but no success
What should I do??
Regards,
James



More information about the Python-list mailing list