> I didn't have your table so I tried to write the same command by one of my
> tables. my query which worked, is:
> SELECT  CASE  WHEN left( workorder, 1  )
> IN (  'C',  'T' )
> THEN  'group1'
> WHEN left( workorder, 1  )
> IN (  '3',  'R' )
> THEN  'gorup2'
> ELSE
> 'group3'
> END  FROM workfile;

which is different from what you wrote in your previous email:

> 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' )));

The difference being the CASE preceding the second WHEN in your
first suggestion.

The query that I got to work is as follows:

SELECT 
CASE 
WHEN
status IN( 'BR', 'VQ', 'RQ', 'NG' )
THEN
'binding' 
WHEN
status IN( 'NA', 'NG', 'RA' )
THEN
'approving'
END as action, status
FROM master_info WHERE
(( status IN ( 'BR', 'VQ', 'RQ', 'NG' )) OR 
 ( status IN ( 'NA', 'NG', 'RA' )));

Thank you very much for your help, Mojtaba!

Chris
-mysql,query,blah


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

Reply via email to