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.
Yes: You can use Inner Join to join on multiple columns.
Merging tables by columns. Multiple tables can be merged by columns in SQL using joins. Joins merge two tables based on the specified columns (generally, the primary key of one table and a foreign key of the other).
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 
                        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 :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With