14 June 2012

MySQL update update more than one table

MySQL update update more than one table In a MySQL update statement you can update more than one table like this

UPDATE tableA A
JOIN tableB B ON A.ID = B.ID
SET B.status = '1', B.status = '1'
WHERE A.ID = 'ID'
Or
UPDATE C
JOIN tableB B ON B.ID = C.ID
JOIN tableA A ON A.ID = B.ID
SET C.status = '1', A.status = '1'
WHERE A.ID = '1' OR A.ID = '2' OR A.ID = '3'

0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Blog by Chagridsada Boonthus | http://chagridsada.blogspot.com/