> entaum fiz assim e naum funcionou. > > select CODIGO, (select sum(valor) where valor >0) as valorPositivo,(select > sum(valor) where valor <0) as valornegativo from TESTE group by CODIGO Em cada sub select você deve vincular o código no where: select sum(valor) where *CODIGO=TESTE.CODIGO AND* valor >0) Eduardo