Jump to content

Update 2 database tables at the same time?


mum4d

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
Link to comment
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..
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.