[Tutor] MySQLdb: cant get '... where field in %s' to work

Justin Ezequiel justin.mailinglists at gmail.com
Mon Jun 26 05:30:26 CEST 2006


I wrote:
>> ARTICLES = ('XXX99999', 'ABZ00002')
>> TESTARTICLENAME = """SELECT * FROM tblForTransfer2Prodsite
>> WHERE articleName IN %r""" % (ARTICLES,)
>> SQLARTICLENAME = """SELECT * FROM tblForTransfer2Prodsite
>> WHERE articleName IN %s"""
>>
>>         print cur.execute(TESTARTICLENAME),
>>         # cannot get this to work
>>         print cur.execute(SQLARTICLENAME, (ARTICLES,))

Matt wrote:
> Can you post your error messages?

Sorry, I neglected to state that I do not get any error message.
I expected both 'execute' statements to print 2 but the second prints 0.
For integers, I get the results I expected.


More information about the Tutor mailing list