RE: [PHP] need help w/ sql query - update and select at once
| From: | Sævar Öfjörð | Date: | Wed, 02 Jul 2003 00:31:40 +0000 |
| Subject: | RE: [PHP] need help w/ sql query - update and select at once | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-153639@lists.php.net to get a copy of this message | ||
Actually, when I took another look at the manual, it says:
Starting with MySQL Version 4.0.4, you can also perform UPDATE
operations that cover multiple tables:
UPDATE items,month SET items.price=month.price
WHERE items.id=month.id;
So it is even newer than 4.0.1
-----Original Message-----
From: Andrew McCombe [mailto:andrew@euperia.com]
Sent: 1. júlí 2003 23:33
To: ofjord@simnet.is
Subject: Re: [PHP] need help w/ sql query - update and select at once
> Theoretically, you should be able to do a multi-table update since
MYSQL
> 3.23, like this:
>
> UPDATE tablename, tablename2 SET tablename.field1 = 'yes' WHERE
> tablename.userid = tablename2.userid;
>
> I haven't tested it, though.
>
Sorry, no you can't do this in 3.23.*. MySQL > 4.01 supports this.
Regards
Andrew