Page 1 of 1

update with joins

Posted: Wed Sep 08, 2004 9:52 am
by ol4pr0
I dont know if this is possible.

something like

UPDATE t.1,t2 SET this=that WHERE t1.unique_id = t2.unique_id ect..

Re: update with joins

Posted: Wed Sep 08, 2004 12:13 pm
by visionmaster
Hello,

Yes, you can cross table delete as well as cross table update. Check out these links:
http://www.electrictoolbox.com/article/mysql
http://www.electrictoolbox.com/article/ ... le-update/

Example:

UPDATE product p
INNER JOIN productPrice pp
ON p.productId = pp.productId
SET pp.price = pp.price * 0.8
WHERE p.dateCreated < '2004-01-01'