I'm using pymysql
package and need to write a query that will get 3 numeric variables that represent the specific date as: year month and day - and use them.
This will look like this:
INSERT INTO tbl1
SELECT id, user_id, search_term
FROM main_table
WHERE year = (var1) AND month = (var2) AND day = (var3);
INSERT INTO tbl2
SELECT id,user_id, find_term
FROM main_table
WHERE year = (var1) AND month = (var2) AND day = (var3);
I need that the 2 insert clauses will use the same var1, var2, var3 that i will define before executing the query.
The thing is - in order to be effcient - i need to do it in the same run. I tried to use (%s) but the problem is the python asks me for 6 arguments and not only 3...
Anyone know what could be helpful here? Thank you!!!