Reputation: 829
idValue = 100
limitValue = 10000
query = "SELECT count(*) as count FROM oneTable WHERE id = (%s) LIMIT (%s)";
cursor.execute(query, (idValue, limitValue ))
This doesn't seem to be working. It fetches only 1 record corresponding to the id.
Upvotes: 3
Views: 159
Reputation: 829
The original query in the question does work. There was some other bug in my code and hence it ceased to work then. Thanks @Baran
Upvotes: 1
Reputation: 41
I think that this should work as you want. If you print result, you can see result of your query.
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()
Upvotes: 1