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

后端 未结 2 1328
时光取名叫无心
时光取名叫无心 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:15
    delete from t
    where id in (1, 4, 6, 7)
    
    0 讨论(0)
  • 2020-12-08 00:21

    Your question almost spells the SQL for this:

    DELETE FROM table WHERE id IN (1, 4, 6, 7)
    
    0 讨论(0)
提交回复
热议问题