Hi,
Have anyone known it is feasible to update one table's column using other table's column when one of column from two tables equal?
I tried many ways like below, always gave me errors.
mysql> UPDATE a SET a.G1= b.G1 where b.L1 = a.L1;
ERROR 1109: Unknown table 'b' in where clause
mysql> UPDATE a SET a.G1= b.G1 where a.L1 = b.L1;
ERROR 1109: Unknown table 'b' in where clause
mysql> UPDATE a INNER JOIN b ON b.L1 = a.L1 SET a.G1=b.G1;
ERROR 1064: You have an error in your SQL syntax near 'INNER JOIN b ON b.L1 = a.L1 SET a.G1=b.G1' at line 1
Help!
Have anyone known it is feasible to update one table's column using other table's column when one of column from two tables equal?
I tried many ways like below, always gave me errors.
mysql> UPDATE a SET a.G1= b.G1 where b.L1 = a.L1;
ERROR 1109: Unknown table 'b' in where clause
mysql> UPDATE a SET a.G1= b.G1 where a.L1 = b.L1;
ERROR 1109: Unknown table 'b' in where clause
mysql> UPDATE a INNER JOIN b ON b.L1 = a.L1 SET a.G1=b.G1;
ERROR 1064: You have an error in your SQL syntax near 'INNER JOIN b ON b.L1 = a.L1 SET a.G1=b.G1' at line 1
Help!