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 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.  Now I want my report to show the English Language meaning for a field  
('Location' in a table called 'Animal')  that contains numeric values.  In other 
languages it would be something like this (a compound if statement):

IF Location=1 MOVE 'Downstairs Cat Room' to Location ELSE IF Location=2 MOVE 'Kitten Room' to Location
ELSE IF Location=3 MOVE 'Quarantine ' to Location
ELSE MOVE 'Unknown' to Location END IF


In other words, I want to test for the comparison being true, and if it isn't true I want to test it again for another value... I couldn't find any information about this construct in the manuals or past list messages. I also tried using the 'CASE .. WHEN .. THEN .. END' but couldn't figure out the syntax errors I was getting.

Thanks again for your help and support-
Sue



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to