sql - update query with inner join [0 rows updated] -
while updating data in table1 inner join
returning o row updated
, both table in different database. got alternate method update this, don't why inner join
query gone wrong.
not working inner join
update db1.table1 set t1.column3='value3' db1.table1 t1 inner join db2.table2 t2 on t1.column2=t2.column2 (t1.column1 = 'value1') , (t2.column3 = 'value3')
working query without using inner join.
update db1.table1 set column3='value3' (column1 = 'value1') , (column3 = 'value3') , (column2 in (select column2 db2.table2 column3='value3' , column3='value3' , column4='value4')) db1..table1 column1 column2 column3 column4 c1 c2 c3a c4 c1 c2 c3a c4 c1 c2 c3b c4 c1 c2 c3b c4 db2..table2 column1 column2 column3 column4 c1 c2 c3a c4 c1 c2 c3a c4 c1 c2 c3b c4
can body suggest this?
you have syntax error in statement. use alias in set , update part or use tablename, don't mix:
update t1 set column3='value3' db1.table1 t1 inner join db2.table2 t2 on t1.column2=t2.column2 (t1.column1 = 'value1') , (t2.column3 = 'value3')