select c1,c2, case when c3 = 0 then c5,c6,c7
else c8,c9,c10 end
from .....
Teria algum outro comando para executar a condição?
Obrigado e t+
select c1,c2, case when c3 = 0 then c5,c6,c7
else c8,c9,c10 end
from .....
select c1,c2,c5,c6,c7
from .....
WHERE campo c3 = 0
UNION ALL
select c1,c2,c8,c9,c10
from .....
WHERE campo c3 <> 0 ;
select c1,c2,
if c3=0
c4-c10 x,c5-c10 y
else
c4-c3 x,c5-c3 y
,c11,c12, --mais outras colunas...
from...
select c1
, c2
, c5 - c6 x
, c7 + c4 y
from .....
WHERE campo c3 = 0
UNION ALL
select c1
, c2
, c8 - c9 x
, c10 * c11 y
from .....
WHERE campo c3 <> 0 ;
Usuários navegando neste fórum: Nenhum usuário registrado e 46 visitantes