[FIXED] insert into table1 from table2 with condition

Issue

I have two tables, and I want to insert data in one of the new column (Orders) of table1 from table2. Any help please, below code is not working

Insert into Table1 (Orders)
  Select (orders) from table2,
  Where table1.id=table2.id

Solution

try this:

update t1
set t1.orders=t2.orders
from  Table1 t1
inner join table2 t2
on t1.id=t2.id


Answered By - irakliG.
Answer Checked By - Marie Seifert (sql.easybugfix Admin)

Related Posts

Post a Comment