Executing “SELECT … WHERE … IN …” using MySQLdb

后端 未结 10 2011
耶瑟儿~
耶瑟儿~ 2020-11-29 21:23

I\'m having a problem executing some SQL from within Python, despite similar SQL working fine from the mysql command-line.

The table looks like this:

10条回答
  •  情话喂你
    2020-11-29 22:16

    this works for me:

    myTuple= tuple(myList)
    sql="select fooid from foo where bar in "+str(myTuple)
    cursor.execute(sql)
    

提交回复
热议问题