I am trying to insert values in table1 if it does not exist on table2. While I can do that using the following:
INSERT INTO table1 (start, stop)
SELECT a.*
FROM (SELECT 123456789 start, 234567890 stop) a
LEFT JOIN table2 b ON (a.start,a.stop) IN ((b.start,b.stop))
WHERE b.start IS NULL
You can see the example here https://stackoverflow.com/a/11998641/719554
I would like to parametrize 123456789 and 234567890 using PDO. HOw can I accomplish that? I thought that I could simply do the following
INSERT INTO table1 (start, stop)
SELECT a.*
FROM (SELECT :start AS start, :stop AS stop) a
LEFT JOIN table2 b ON (a.start,a.stop) IN ((b.start,b.stop))
WHERE b.start IS NULL