Updating multiple tables in a single sql statement

UPDATE table1
INNER JOIN table2 USING (customer_id)
SET table1.customer_id = 5, table2.customer_id = 5
WHERE table1.customer_id = 3

OR

UPDATE table1,table2 SET table1.col=a,table2.col2=b
WHERE table1.items_id=3 AND table2.items_id=3;

Advertisements
Categories: General | Leave a comment

Post navigation

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: