topics='1,4,7'
t=text("SELECT * FROM tb_rcsy where id in (:ids))
rcsy=conn.execute(t, ids=topics).fetchall()
print rcsy
出错:Warning: Truncated incorrect DOUBLE value: '1,4,7'
我测试了一下,如果直接把变量放进去:
t=text("SELECT * FROM tb_rcsy where id in (1,4,7))
rcsy=conn.execute(t).fetchall()
print rcsy
就ok.
问题:如何处理像ids这样的变量?
ps:如果是逗号隔开,就是字符串,但是in后面又不需要字符串,两难!
find_in_set