I have two tables table1, table2. Both the tables can be joined based on empID.
I have a new column in table1 called tabseqno. I want to update tabseqno of table1 with tabseqno from table2.
UPDATE TABLE1 SET TABLE1.TABSEQNO =TABLE2.TABSEQNO
WHERE TABLE1.EMPID= TABLE2.EMPID AND TABLE2.GROUPID=99
Either:
or:
depending on what you want to happen if there is no matching table2 row for a table 1 row (the first statement will set table1.tabseqno to null, the second will not update those rows at all).
Both only work if the table2 subquery can only return a maximum of 1 row for any
empid.