It is necessary that everything is removed, and not the first. That is, I have an array of two values ​​(id and parent_id, this is a unique index consisting of two values), in a single query I need to delete all the elements of the array.

DELETE FROM table WHERE (id=4 AND parent_id = 6) OR (id=5 AND parent_id = 6) OR (id=5 AND parent_id=12) 
  • one
    It seems to me that you are not saying something. This query will delete all entries in which (id = 4 and parent = 6) also all entries for the rest of the conditions. Those. he must do exactly what you write, he supposedly does not. Or you want not quite this, but poorly described what is required. Try to give an example of the input data and specify the removal of any records from the example you expect - Mike
  • Did not check, it seemed to me there should be a special syntax. - manking
  • one
    just to remove not everything, a special syntax is required. if the conditions are not specified, all the records from the table will be deleted altogether, the conditions reduce the number of - Mike
  • exactly confused. I thought he would stop at version 1 and stop deleting further. - manking
  • That should work, yes. It is possible, from interest, to rewrite something like (id, parent_id) IN ((4, 6), (5, 6), (5, 12)) But it is necessary to measure seven times. - D-side

0