J
Jeff Elkins
I'm attempting to pass an SQL query via the console:
$ ./getbd month 05
The arguments get seem to passed correctly (via print statements) and then:
cursor.execute ("""
SELECT name, month, day ,category, city FROM bday
WHERE %s = %s
""",(arg1,arg2))
No results. However, if I hardcode the WHERE argument with a field name:
cursor.execute ("""
SELECT name, month, day ,category, city FROM bday
WHERE month = %s
""",(arg2))
It works.
How can I code the left side of the WHERE clause so I can pass an arbitrary
field name to search on?
Thanks,
Jeff Elkins
$ ./getbd month 05
The arguments get seem to passed correctly (via print statements) and then:
cursor.execute ("""
SELECT name, month, day ,category, city FROM bday
WHERE %s = %s
""",(arg1,arg2))
No results. However, if I hardcode the WHERE argument with a field name:
cursor.execute ("""
SELECT name, month, day ,category, city FROM bday
WHERE month = %s
""",(arg2))
It works.
How can I code the left side of the WHERE clause so I can pass an arbitrary
field name to search on?
Thanks,
Jeff Elkins