gpt4 book ai didi

sqlite - SQlite删除内部联接

转载 作者:行者123 更新时间:2023-12-03 15:39:21 26 4
gpt4 key购买 nike

我已经阅读了很多其他答案,但无法正常工作!

select * from invTypes
inner join invGroups on invtypes.groupID = invgroups.groupID
where invGroups.categoryID = 25;


如果类别ID匹配到25,我只是想从invTypes中删除记录

非常感谢您的协助

我已经尝试过:

delete from invTypes
inner join invGroups on invtypes.groupID = invgroups.groupID
where invGroups.categoryID = 25;


给出错误:
在“内部”附近:语法错误:

DELETE FROM invTypes
WHERE groupID in ( SELECT groupID FROM invGroups INNER JOIN invTypes ON (invGroups.groupID = invTypes.groupID)
WHERE invGroups.categoryID = 25);


给出:
列名不明确:groupID:从invTypes中删除
WHERE invGroups.categoryID = 25)中的groupID(从invGroups内连接中选择groupID INNER JOIN invTypes ON(invGroups.categoryID = invTypes.categoryID)。

最佳答案

您可以将deletewhere子句一起使用

delete from invTypes
where groupId in ( select groupId from invGroups where CategoryID =25)

关于sqlite - SQlite删除内部联接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27972140/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com