Questions tagged «multiple-records»

3
MySQL在每行唯一的一个查询条件中删除多行
因此,我知道在MySQL中可以在一个查询中插入多个行,如下所示: INSERT INTO table (col1,col2) VALUES (1,2),(3,4),(5,6) 我想以类似的方式删除多行。我知道可以根据每一行的完全相同的条件删除多行,即 DELETE FROM table WHERE col1='4' and col2='5' 要么 DELETE FROM table WHERE col1 IN (1,2,3,4,5) 但是,如果我想在一个查询中删除多行,而每一行都有一组唯一的条件,该怎么办?我想要的是这样的东西: DELETE FROM table WHERE (col1,col2) IN (1,2),(3,4),(5,6) 有人知道这样做的方法吗?还是不可能?
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.