All Forums Database
wvrosario 1 post Joined 04/09
11 May 2009
Case

could someone help mebetween the need to query both the first "when" as in other "when" that exists with the same conditionselect case when (a11.CAMPO = 1) then 'SP' when (a11.CAMPO = 2) then 'SPINT' when (a11.CAMPO = 3) then 'RJ' when (a11.CAMPO = 4) then 'MG' when (a11.CAMPO = 5) then 'SC' when (a11.CAMPO = 6) then 'RS' when (a11.CAMPO = 7) then 'CO' when (a11.CAMPO = 8) then 'N' when (a11.CAMPO = 9) then 'SE' when (a11.CAMPO = 10) then 'NE' when (a11.CAMPO in (1,2)) then 'SP' when (a11.CAMPO in (7,8)) then 'CON' when (a11.CAMPO in (1,2,3,4,5,6,7,8,9,10)) then 'TODOS' when (a11.CAMPO in (1,2,3,4,6,7,8,9,10)) then 'TODOS SEM MINAS' end CustCol_27from TABELA a11Tks allWilliam Rosário

Adeel Chaudhry 773 posts Joined 04/08
11 May 2009

Hello,Can you please explain what exactly you need to do?Regards,Adeel

-- If you are stuck at something .... consider it an opportunity to think anew.

joedsilva 505 posts Joined 07/05
12 May 2009

Case is always evaluated and processed from the first, and the first true condition is what you always get as output. Besides once case statement can output only one attribute.So in your case, you should probably move the last two conditions to two another case statements.

You must sign in to leave a comment.