Re: Syntax for Compound "IF" Statements?

2005-02-08 Thread SGreen
"Sue Cram" <[EMAIL PROTECTED]> wrote on 02/08/2005 01:18:48 AM: > Thanks to the people who helped me with my IF statement question > last night. Now I need to carry it one step further to a compound > 'IF' statement. Again, can't find much information in the manuals -- > > Several people sent

Re: Syntax for Compound "IF" Statements?

2005-02-08 Thread Ian Sales (DBA)
Harald Fuchs wrote: That's correct, but it can be written shorter and clearer: CASE Lccation WHEN 1 THEN 'Downstairs Cat Room' WHEN 2 THEN 'Kitten Room' WHEN 3 THEN 'Quarantine' ELSE 'Unknown' END AS Location - surely it would be better to have the location ids and location names in a lookup ta

Re: Syntax for Compound "IF" Statements?

2005-02-08 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Johan Höök <[EMAIL PROTECTED]> writes: > Hi, > I guess your "CASE" statement should look something like: > CASE WHEN Location=1 THEN 'Downstairs Cat Room' > WHEN Location=2 THEN 'Kitten Room' > WHEN Location=3 THEN 'Quarantine' > ELSE 'Unknown' EN

Re: Syntax for Compound "IF" Statements?

2005-02-08 Thread Gabriel PREDA
I didn't found an IF ... ELSE ... in MySQL ... and I'm using it for at least 4 years !... since the old 3.23.xx times !!! So you will have to do: SELECT a,b,c, IF(Location=1, 'Downstairs Cat Room', IF(Location=2, 'Kitten Room',

Re: Syntax for Compound "IF" Statements?

2005-02-08 Thread Johan Höök
Hi, I guess your "CASE" statement should look something like: CASE WHEN Location=1 THEN 'Downstairs Cat Room' WHEN Location=2 THEN 'Kitten Room' WHEN Location=3 THEN 'Quarantine' ELSE 'Unknown' END AS Location /Johan Sue Cram wrote: Thanks to the people who helped me with my IF state

Re: Syntax for Compound "IF" Statements?

2005-02-07 Thread David Blomstrom
I did a lot of homework on IF statements recently. Below are copies of some of the scripts I'm using now. This first example draws on a database filled with the names of the world's continents, oceans, nations and states, each given an ID in a field named IDArea. Each page on my site has an echo s

Syntax for Compound "IF" Statements?

2005-02-07 Thread Sue Cram
Thanks to the people who helped me with my IF statement question last night. Now I need to carry it one step further to a compound 'IF' statement. Again, can't find much information in the manuals -- Several people sent me "IF (Adopted=1, 'Y', 'N') AS Adopted FROM Animal" and it works great.