How to delete from a table where ID is in a list of IDs?

后端 未结 2 1331
时光取名叫无心
时光取名叫无心 2020-12-08 00:15

if I have a list of IDs (1,4,6,7) and a db table where I want to delete all records where ID is in this list, what is the way to do that?

2条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-08 00:21

    Your question almost spells the SQL for this:

    DELETE FROM table WHERE id IN (1, 4, 6, 7)
    

提交回复
热议问题