Jump to content


This topic is now archived and is closed to further replies.


Update 2 database tables at the same time?

Recommended Posts

Is it posable to update/insert into 2 database tables (with the same information) at the same time. I want one table to be used as a "shopping basket" and the other as "stock control" so I need the same data in each but when the shopping basket is emptied by the user the data remains in a second table for stock control.

Thanks in advance

Share this post

Link to post
Share on other sites
yeah it is

UPDATE table1,table2 SET table1.field = 'value', table2.field = 'value'

and i think this second one for inert is correct..

INSERT INTO table1, table2 (table1.field1,table1.field2,table2.field1,table2.field2) VALUES('table 1 value1','table 1 value2',' table 2 value3','table 2 value4')

I'm not 100% on the insert as i have not found anything on inserting into 2 tables in 1 query i would personaly use 2 seperate querys to insert same data..

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.