Jump to content


Photo

Update 2 database tables at the same time?


  • Please log in to reply
1 reply to this topic

#1 mum4d

mum4d
  • Members
  • PipPip
  • Member
  • 10 posts

Posted 18 April 2006 - 04:44 PM

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


#2 shocker-z

shocker-z
  • Members
  • PipPipPip
  • Advanced Member
  • 864 posts
  • LocationNottingham

Posted 18 April 2006 - 05:27 PM

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..
www: www.ukchat.ws | irc: irc.ukchat.ws chan: #blufudge




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users