我使用这个脚本,想加入2和表3分的条件和更新T1:SQL内连接2台带有多列的条件和更新
Update T1 set T1.Inci = T2.Inci
ON T1.Brands = T2.Brands
AND T1.Category= T2.Category
AND T1.Date = T2.Date
,但我遇到的问题:
Incorrect syntax near the keyword 'ON'
。
不知道为什么。
我使用这个脚本,想加入2和表3分的条件和更新T1:SQL内连接2台带有多列的条件和更新
Update T1 set T1.Inci = T2.Inci
ON T1.Brands = T2.Brands
AND T1.Category= T2.Category
AND T1.Date = T2.Date
,但我遇到的问题:
Incorrect syntax near the keyword 'ON'
。
不知道为什么。
UPDATE
T1
SET
T1.Inci = T2.Inci
FROM
T1
INNER JOIN
T2
ON
T1.Brands = T2.Brands
AND
T1.Category= T2.Category
AND
T1.Date = T2.Date
你需要做的
Update table_xpto
set column_xpto = x.xpto_New
,column2 = x.column2New
from table_xpto xpto
inner join table_xptoNew xptoNew ON xpto.bla = xptoNew.Bla
where <clause where>
如果你需要一个更好的答案,你可以给我们更多的信息:)
你可以添加一个链接到SQL语法更新。 – 2010-07-01 08:54:20
你是对的 here:http://msdn.microsoft.com/en-us/library/ms177523.aspx – 2010-07-01 09:00:02
UPDATE T1,T2
INNER JOIN T1 ON T1.Brands = T2.Brands
SET
T1.Inci = T2.Inci
WHERE
T1.Category= T2.Category
AND
T1.Date = T2.Date
读者可以通过内部连接了解它。至少是语法方式。 – vikasmcajnu 2015-02-12 17:19:53
'ON'和'AND'运算符只验证平等吗?他们可以做相当于if((T1.Brands T2.Category))吗? –
2014-02-08 00:26:06