I needed to delete the rows returned by a complex and nested select statement. Something like this:
DELETE FROM table1 where table1.x NOT IN (SELECT table1.x ...)
Which was not possible in MySQL or at least I was unable to write!
So I did this:
SELECT concat('delete from table1 t1 WHERE t1.x = ', x , ';') FROM table1 t1 WHERE t1.x NOT IN (SELECT table1.x ...);
This gives me the delete statements to remove the rows I want.
Not so clever but solved my problem!
DELETE FROM table1 where table1.x NOT IN (SELECT table1.x ...)
Which was not possible in MySQL or at least I was unable to write!
So I did this:
SELECT concat('delete from table1 t1 WHERE t1.x = ', x , ';') FROM table1 t1 WHERE t1.x NOT IN (SELECT table1.x ...);
This gives me the delete statements to remove the rows I want.
Not so clever but solved my problem!