I am trying to run multiple SQL queries where the LIKE operator contains every element of a list in Python. I have a long list of strings
l = ['string1', 'string2', 'string3',....]
query_1 = "SELECT COUNT(request) FROM table WHERE request LIKE 'l[0]' AND DATE BETWEEN 'date1' AND 'date2'".format(l[0])
query_2 = "SELECT COUNT(request) FROM table WHERE request LIKE 'l[1]' AND DATE BETWEEN 'date1' AND 'date2'".format(l[1])
query_3 = "SELECT COUNT(request) FROM table WHERE request LIKE 'l[2]' AND DATE BETWEEN 'date1' AND 'date2'".format(l[1])
and so on.
How would I run multiple queries and then concatenate them? Is it possible to use the execute function on multiple queries or can it only work with one? Would I use a for loop?
EDIT: In the previous version of this question, I asked about running ONE query with multiple list elements in the LIKE operator. I realized that the final query was something along the lines of:
SELECT COUNT(request) FROM table WHERE request LIKE 'l[0]' OR LIKE 'l[1]' OR LIKE 'l[2]' AND DATE BETWEEN 'date1' AND 'date2'.
That was not what I needed.
executescriptmethod for the cursor?