How do I delete multiple rows with different IDs?

ave4496 picture ave4496 · Oct 28, 2010 · Viewed 100.8k times · Source

I want to do something like this:

DELETE FROM table WHERE id IN (SELECT ....)

How can I do that?

Answer

Thilo picture Thilo · Oct 28, 2010

If you have to select the id:

 DELETE FROM table WHERE id IN (SELECT id FROM somewhere_else)

If you already know them (and they are not in the thousands):

 DELETE FROM table WHERE id IN (?,?,?,?,?,?,?,?)