MySQL delete multiple rows in one query conditions unique to each row
multiple-records, mysql, unique-constraint
Solution
You were very close, you can use this:
DELETE FROM table WHERE (col1,col2) IN ((1,2),(3,4),(5,6))
Please see this fiddle.
Problem
So I know in MySQL it's possible to insert multiple rows in one query like so: ``` INSERT INTO table (col1,col2) VALUES (1,2),(3,4),(5,6) ``` I would like to delete multiple rows in a similar way. I know it's possible to delete multiple rows based on the exact same conditions for each row, i.e. ``` DELETE FROM table WHERE col1='4' and col2='5' ``` or ``` DELETE FROM table WHERE col1 IN (1,2,3,4,5) ``` However, what if I wanted to delete multiple rows in one query, with each row having a set of conditions unique to itself? Something like this would be what I am looking for: ``` DELETE FROM table WHERE (col1,col2) IN (1,2),(3,4),(5,6) ``` Does anyone know of a way to do this? Or is it not possible?