Sqlite 删除查询错误 [英] Sqlite delete query error
问题描述
delete N.* from Tbl_Nodes N, Data_Tree DT WHERE N.Part = DT.Part
对于此命令,我收到以下错误.
for this command I am getting following error.
System.Data.SQLite.SQLiteException: SQLite error near "N": syntax error
以上命令适用于 MSAccess.
Above command works fine for MSAccess.
有没有其他方法可以在 Sqlite 中使用表格快捷方式?
Is there any alternative to use table shortcut in Sqlite?
推荐答案
DELETE 语句对单个表进行操作,并且不使用表别名.因此,您的 FROM 子句必须读取 FROM Tbl_Nodes
.
The DELETE statement operates on a single table and does not use a table alias. Therefore, your FROM clause must read FROM Tbl_Nodes
.
您可能正在寻找:
delete from Tbl_Nodes WHERE Part IN (SELECT Part FROM Data_Tree)
请注意,这将从 Tbl_Nodes 中删除 所有 节点,这些节点在 Data_Tree
中具有相应的 Part
值,但不会从 中删除任何记录>Data_Tree
本身.
Note that this will remove all nodes from Tbl_Nodes that have a corresponding Part
value in Data_Tree
but does not remove any records from Data_Tree
itself.
虽然 SQL 因供应商而异,但作为一般原则,从 MS Access 学习 SQL 并尝试将其应用于其他产品是错误的.MS Access 具有一些非常非标准的结构.
While SQL varies somewhat among vendors, as a general principle it's a mistake to learn SQL from MS Access and try to apply it to other products. MS Access features some very non-standard constructions.
这篇关于Sqlite 删除查询错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!