0

我正在执行以下查询

DELETE FROM List,Tree WHERE List.CatID = Tree.CatID AND List.ID = '1' AND Tree.Cat = '332'

但我遇到以下错误

near ",": syntax error
4

2 回答 2

0

删除语句的正确语法是这样

DELETE FROM table_name WHERE somecolumn=somevalue

因此,您不能通过用逗号分隔它们来在单个删除查询中使用 2 个表。

你需要做类似的事情

DELETE something FROM table_name INNER JOIN...
于 2012-10-12T07:56:30.847 回答
0

您一次只能从一个表中删除,并且您必须将连接重写为子查询:

DELETE FROM List
WHERE ID = '1'
  AND CatID IN (SELECT CatID
                FROM Tree
                WHERE Cat = '332')
于 2012-10-12T08:43:22.150 回答