How do I delete multiple rows with different IDs?

前端 未结 4 636
粉色の甜心
粉色の甜心 2020-12-13 13:09

I want to do something like this:

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

How can I do that?

4条回答
  •  囚心锁ツ
    2020-12-13 13:46

    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 (?,?,?,?,?,?,?,?)
    

提交回复
热议问题