0

我不知道我的查询出了什么问题,但我收到了这个错误:

Error Code : 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'From a
INNER JOIN table2 b
ON  a.column1 = b.column1 AND a.column2 = b.column2' at line 4

这是我正在尝试的 sql:

UPDATE table1 AS a
Set a.Closed = 2

From a
INNER JOIN table2 b
ON  a.column1 = b.column1 AND a.column2 = b.column2
WHERE number in (01809076,02170039);
4

3 回答 3

5

in MySQL, UPDATEwith join 的语法是这样的。(FROM条款

UPDATE  table1 AS a
        INNER JOIN table2 b
            ON  a.column1 = b.column1 AND 
                a.column2 = b.column2
SET     a.Closed = 2
WHERE   b.number in (01809076,02170039);

您当前使用的是T-SQL

于 2012-11-21T06:28:20.290 回答
0

你可以轻松做到:

UPDATE  table1,table2 
SET     table1.Closed = 2
WHERE   table1.column1 = b.column1 AND table1.column2 = table2.column2 AND table2.number in (01809076,02170039) ;
于 2012-11-21T07:15:17.947 回答
0

请像这样更新您的查询:

更新表 1 设置关闭 = 2

从 table1 a INNER JOIN table2 b ON a.column1 = b.column1 AND a.column2 = b.column2 WHERE number in (01809076,02170039);

它肯定会起作用

谢谢乌塔姆

于 2012-11-21T06:42:32.367 回答