I am using this script, trying to join 2 tables with 3 conditions and update T1:
Update T1 set T1.Inci = T2.Inci
ON T1.Brands = T2.Brands
AND T1.Category= T2.Category
AND T1.Date = T2.Date
but I encounter:
Incorrect syntax near the keyword 'ON'
.
Can't figure it out why.
This question is related to
sql
sql-update
inner-join
You need to do
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>
If you need a better answer, you can give us more information :)
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
You should join T1 and T2 tables using sql joins in order to analyze from two tables. Link for learn joins : https://www.w3schools.com/sql/sql_join.asp
Source: Stackoverflow.com