I have 2 tuples a and b
print(a)
(1,2,3,4,5)
print(b)
(1,)
As you can see the second one has a single value... For the first one I use
query_a = 'SELECT something FROM mytable WHERE id IN {};'.format(a)
It works perfectly.
If I do the same for b, it doesn't work. It shows:
Error: blah blah blah ..WHERE id IN (1,);': (1064, "You have an error in your SQL syntax...
I believe the error is because of the tuple comma -> (1,) How do I solve this. I tried
query_b = 'SELECT something FROM mytable WHERE id IN ();'.format(b)
but it also doesn't work. How do I fix this in one line? Thanks.