SELECT CASE WHEN status IN('BR', 'VQ', 'RQ', 'NG' ) THEN 'binding' CASE WHEN status IN('NA', 'NG', 'RA') END as action FROM master_info WHERE (( status IN ( 'BR', 'VQ', 'RQ', 'NG' )) OR ( status IN ( 'NA', 'NG', 'RA' )));
----- Original Message ----- From: "Chris Boget" <[EMAIL PROTECTED]> To: "MySQL" <[EMAIL PROTECTED]> Sent: Friday, October 24, 2003 2:19 PM Subject: Case statement > I'm trying to do something like the following: > > SELECT > CASE status > WHEN > IN ( 'BR', 'VQ', 'RQ', 'NG' ) > THEN > 'binding' > WHEN > IN ( 'NA', 'NG', 'RA' ) > THEN > 'approving' > END as action > FROM master_info WHERE > (( status IN ( 'BR', 'VQ', 'RQ', 'NG' )) OR > ( status IN ( 'NA', 'NG', 'RA' ))); > > But this query is obviously going to fail. But there _has_ to be > a more elegant way than doing: > > WHEN > 'BR' > THEN > 'binding' > WHEN > 'VQ' > THEN > 'binding' > ... > > Is there? If so, I can't figure out what it would be. Any suggestions? > > thnx, > Chris > -mysql,query,blah > > > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]