Re: Re: LEFT JOIN in UPDATE

From: Date: Sun, 03 Feb 2002 21:30:04 +0000
Subject: Re: Re: LEFT JOIN in UPDATE
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-16466@lists.php.net to get a copy of this message
on 2/3/02 3:36 PM, Lutz Brückner at lb@lamuella.de appended the following bits to my mbox: >> Question is how to properly form a LEFT JOIN using >> UPDATE... I tried: >> >> UPDATE product_price LEFT JOIN temp >> SET product_price.product_price_vdate = 1 (del flag) >> ON product_price.product_id = temp.product_id >> WHERE temp.product_id IS NOT NULL > I just read http://www.mysql.com/doc/U/P/UPDATE.html once more, > but can not find anything about mysql supporting JOIN in UPDATE > statements. I believe Lutz is right. You are using PHP, right? Any MySQL? Some RDBMS systems provide ways of linking database table records to each other via foreign keys and others allow you to create triggers that are performed by the database server when certain actions happen. MySQL does not. They believe the application programmer should take care of those "application" pieces. So, if you're using MySQL, do the select statement first with the join, then loop through the results and perform the update. Paul <?php while ($self != "asleep") { $sheep_count++; } ?>

« previous php.db (#16466) next »