Two tables can be easily joined during an update, similar to a join used in a select statement. This comes in handy specially when one table needs to be updated based on a condition in another table. Below is one such example.
UPDATE C
SET C.permanentAddress='#000, Marine Drive, Galle, Sri Lanka'
FROM Customer AS C INNER JOIN users AS U
ON U.userId = C.customerId
WHERE U.loginName LIKE('%ashaamil%')
That's pretty much about it !
UPDATE C
SET C.permanentAddress='#000, Marine Drive, Galle, Sri Lanka'
FROM Customer AS C INNER JOIN users AS U
ON U.userId = C.customerId
WHERE U.loginName LIKE('%ashaamil%')
That's pretty much about it !
No comments:
Post a Comment