如何从 ID 在 ID 列表中的表中删除? [英] How to delete from a table where ID is in a list of IDs?

查看:26
本文介绍了如何从 ID 在 ID 列表中的表中删除?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我有一个 ID 列表 (1,4,6,7) 和一个 db 表,我想在其中删除 ID 在此列表中的所有记录,有什么方法可以做到这一点?

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?

推荐答案

你的问题几乎拼出了 SQL:

Your question almost spells the SQL for this:

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

这篇关于如何从 ID 在 ID 列表中的表中删除?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆