问题描述
我已经阅读了很多其他答案,但无法解决这个问题!
I have read alot of other answers but cannot get this working!.
select * from invTypes
inner join invGroups on invtypes.groupID = invgroups.groupID
where invGroups.categoryID = 25;
如果类别 ID 与 25 匹配,我只想从 invTypes 中删除记录
I simply want to delete the record from invTypes if the category ID matches to 25
非常感谢您的帮助
我已经试过了:
delete from invTypes
inner join invGroups on invtypes.groupID = invgroups.groupID
where invGroups.categoryID = 25;
给出错误:靠近内部":语法错误:
Gives error:near "inner": syntax error:
DELETE FROM invTypes
WHERE groupID in ( SELECT groupID FROM invGroups INNER JOIN invTypes ON (invGroups.groupID = invTypes.groupID)
WHERE invGroups.categoryID = 25);
给出:不明确的列名:groupID:DELETE FROM invTypesWHERE groupID in (SELECT groupID FROM invGroups INNER JOIN invTypes ON (invGroups.categoryID = invTypes.categoryID) WHERE invGroups.categoryID = 25);
Gives:ambiguous column name: groupID: DELETE FROM invTypesWHERE groupID in ( SELECT groupID FROM invGroups INNER JOIN invTypes ON (invGroups.categoryID = invTypes.categoryID) WHERE invGroups.categoryID = 25);
推荐答案
你可以使用 delete
和 where
子句
you can use delete
with a where
clause
delete from invTypes
where groupId in ( select groupId from invGroups where CategoryID =25)
这篇关于SQLite 删除内连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!