updating mysql table
| From: | Libor Matyáš | Date: | Fri, 01 Dec 2000 21:06:54 +0000 |
| Subject: | updating mysql table | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-4943@lists.php.net to get a copy of this message | ||
hi,
anybody knows how to do the following:
i've got two tables with the same field structure. i want table x update
according to table y. what's the correct php mysql statement?
i tried:
mysql_query("update x set (fld1, fld2, ..) = (select fld1, fld2, .. from y
where fld3='xyz') where fld3='xyz'", $connection);
mysql_query("update x set (select * from y where fld3='xyz') where
fld3='xyz'", $connection);
mysql_query("update x set (*) = (select * from y where fld3='xyz') where
fld3='xyz'", $connection);
according to my sql reference syntax guide, the first attempt should have
worked. (the .. stands for all the rest fields in the table)
regards
libor matyas