RE: [PHP-DB] SQL conditional UPDATE
| From: | Richard Allsebrook | Date: | Thu, 12 Oct 2000 14:50:04 +0000 |
| Subject: | RE: [PHP-DB] SQL conditional UPDATE | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-3556@lists.php.net to get a copy of this message | ||
How about two queries:
UPDATE table SET field1 = "valuea" WHERE condition1
UPDATE table SET field1 = "valueb" WHERE NOT condition1
_____
~ Richard Allsebrook ~
Applications Developer and Webmaster
Easysoft Limited, No3 The Embankment, Leeds, LS1 4BJ
http://www.easysoft.com <http://www.easysoft.com> - http://www.cinema.com
<http://www.cinema.com>
"A computer lets you make more mistakes faster than any invention in human
history - with the possible exceptions of handguns and tequila."
_____
-----Original Message-----
From: Derek Paterson [mailto:d.paterson@craneware.com]
Sent: Thursday, October 12, 2000 2:47 PM
To: PHP Database List
Subject: [PHP-DB] SQL conditional UPDATE
Is there any way within one SQL query to Update to different values
dependant on conditions. I've guessed at subqueries but cannot get my head
round the syntax and web advice differs dependant on source.
eg.
UPDATE table SET field1 = "valuea" WHERE condition1 ELSE field1 = "valueb"
I know I could build dynamic queries in PHP but this db isn't on the web
yet - trying to get it into shape to put it there.
TIA
Derek
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
For additional commands, e-mail: php-db-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net