本文介绍了如何在“SELECT ... IN()”中替换和字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我在下一个查询中遇到BIIIIIG问题:


cursor.execute("""

SELECT titem.object_id,titem.tag_id

FROM tagging_taggeditem titem

WHERE titem.object_id IN(%s)

""",(eid_list))


eid_list被假定为ids列表= [1,5,9]


我怎样才能使它工作?


谢谢

Hi,

I have a BIIIIIG problem with the next query:

cursor.execute("""
SELECT titem.object_id, titem.tag_id
FROM tagging_taggeditem titem
WHERE titem.object_id IN (%s)
""",( eid_list))

eid_list is suppossed to be a list of ids = [1,5,9]

How can I make it work?

Thanks

推荐答案



^

它应该d而不是''%''。

HTH。


-

问候,

Wojtek Walczak,




* * * * * * * * * * * ^

它应该是''%''。

HTH。


-

问候,

Wojtek Walczak,




^

它应该是''%''。

^
It should rather be ''%''.



请避免这些无能为力的建议并阅读python db-api的文档。

Please avoid such clueless advices and read the doc of the python db-api.


这篇关于如何在“SELECT ... IN()”中替换和字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-24 13:50