Ciao.Potresti usare le sub query per ottenere il risultato che vuoi.select data, a, b, a+b
from (
select max(data) data, sum(importo) a, 0 b
from incassi
where tipo ='A'
group by tipo
union
select max(data) data, 0 a, sum(importo) b
from incassi
where tipo ='B'
group by tipo
) a
order by data;
Il Case:CASE <expression> WHEN <exp1> THEN result1 WHEN <exp2> THEN result2 ... [ELSE defaultresult] END
CanVote = case when Age >= 18 then 'Yes' when Age < 18 then 'No' else 'Unsure' end;
Al posto della tabella potresti usare una vista.In modo da permettere al db engine di ottimizzare in qualche modo l'accesso.:)
Stilgar