2024-07-04 06:17:33 发布
网友
idValue = 100 limitValue = 10000 query = "SELECT count(*) as count FROM oneTable WHERE id = (%s) LIMIT (%s)"; cursor.execute(query, (idValue, limitValue ))
这好像不管用。它只获取与id对应的一条记录
我想这应该是你想要的。若您打印结果,您可以看到您的查询结果。你知道吗
idValue = 100 limitValue = 10000 query = "SELECT count(*) as count FROM oneTable WHERE id = {0} limit {1}".format(idValue,limitValue) cursor.execute(query) result = cursor.fetchall()
问题中的原始查询不起作用。在我的代码中有一些其他的bug,因此它停止了工作。谢谢@Baran
我想这应该是你想要的。若您打印结果,您可以看到您的查询结果。你知道吗
问题中的原始查询不起作用。在我的代码中有一些其他的bug,因此它停止了工作。谢谢@Baran
相关问题 更多 >
编程相关推荐