Addressed to: "Derek Paterson" <[EMAIL PROTECTED]>
              [EMAIL PROTECTED]

** Reply to note from "Derek Paterson" <[EMAIL PROTECTED]> Thu, 12 Oct 2000 
14:46:51 +0100
>   
> 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"
>   


UPDATE table SET field1 = IF( condition1, 'valuea', 'valueb' );


An hour or two spend perusing the MySQL documentation might be very
valuable.  Chapter 7, the MySQL Language Reference is the area to spend
most of your time.

http://www.mysql.com/documentation/mysql/commented/manual.php?section=Reference


Within that section you will find 7.4 Functions for Use in SELECT and WHERE
Clauses very useful:


http://www.mysql.com/documentation/mysql/commented/manual.php?section=Functions





Rick Widmer
Internet Marketing Specialists
www.developersdesk.com

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to