删除数据库表中的几行
我正在使用代码生成器。我有两张桌子。在一张表中,我有 user_id 和该 user_id 的几个文档。在第二个表中有此 user_id 的文档,但没有 user_id,我必须删除这些文档。 请帮忙!
I am using code-generator. I have two tables. In one table I have user_id an several docs of this user_id. In second table a have docs of this user_id, but without user_id and I have to delete these docs.
Please help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我假设您对要删除其文档的用户有一些标准,但不是外键?只需使用 半连接,您也可以在
DELETE
语句中使用它。假设您的搜索条件类似于
用户名
:In SQL
In Java
I'm assuming you have some criteria about the user whose documents you want to delete, just not the foreign key? Just use a semi-join, which you can use in
DELETE
statements as well.Assuming your search criteria is something like the
username
:In SQL
In Java