p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

beginning_php thread: MSQL UPDATE multiple tables


Message #1 by "Anthony Bollino" <abollino@w...> on Sat, 21 Sep 2002 10:36:06 -0400
Hello,
I am hoping to save time by updating two tables in MYSQL in one SQL
statement.  I can't get it to work.  Is it even possible to update more than
one table in a single SQL statement using something like LEFT JOIN?  Here is
what I tried.

UPDATE pncw_scat_classnames, pncw_current_classes
SET pncw_scat_classnames.name = 'Math 6 and Test'
,pncw_scat_classnames.description = 'This is a test of UPDATE after I
combined two SQL statements', pncw_current_classes.section = 'LIONS WIN
AGAIN!!'
LEFT JOIN pncw_scat_classnames
ON pncw_scat_classnames.id = pncw_current_classes.name_id
WHERE pncw_scat_classnames.id = 11

Thank you,

Tony Bollino
Weevinwebs.com
"Your Complete Small and Home Business Solution."
http://www.weevinwebs.com/
xxx-xxx-xxxx
abollino@w...



Message #2 by "David Scott-Bigsby" <DScott-Bigsby@P...> on Mon, 23 Sep 2002 10:41:03 -0700
> I am hoping to save time by updating two tables in MYSQL in one SQL
> statement.

I'm pretty sure you can't. In many database products, you can wrap 
multiple updates (and other queries) in a transactaion, to ensure the 
integrity of the data, by MySQL isn't slated to support transactions for 
a while.

> Is it even possible to update more than
> one table in a single SQL statement using something like LEFT
> JOIN?  Here is what I tried.

I know you can do this sort of thing with MS Access, but I think they 
use a "recordset" object, so the actual SQL handling the updates is all 
behind the scenes.

dsb

***************************************       
David Scott-Bigsby
Product Manager, Web Site and PEDN

PureEdge Solutions
The Leader in Secure XML e-Forms

v:250-708-8145  f:250-708-8010
1-888-517-2675   www.PureEdge.com
***************************************


  Return to Index