So you have a table where you want to delete a bunch of rows, based on a particular column being matched in another table.
This is easily achievable with MySQL.
DELETE FROM TABLE1 WHERE domain IN ( SELECT domain FROM TABLE2 )
The above SQL will delete all rows in
TABLE1 that are found in
But what if we need to limit which records are returned from
That’s simple too. All we need to do is add a traditional
WHERE clause to our select statement.
DELETE FROM TABLE1 WHERE domain IN ( SELECT domain FROM TABLE2 WHERE column1='1' AND column2<>'2' )