Monday, December 5, 2022

Update columns values with column of another table based on condition in SQL command


UPDATE table1 SET price=(SELECT price FROM table2 WHERE table1.id=table2.id);

or,
UPDATE table1 SET table1.price=(SELECT table2.price FROM table2 WHERE table2.id=table1.id AND table2.item=table1.item);

or,
UPDATE event INNER JOIN cualumni ON event.user_id = cualumni.eid SET event.user_id = cualumni.id;


Or,

UPDATE table1 INNER JOIN table2 ON table1.id = table2.id SET table1.Price = table2.price

No comments:

Post a Comment

Office 2021 Activation using command

  @echo off title Activate Microsoft Office 2021 (ALL versions) for FREE - office.com&cls&echo =====================================...