SUBTRACAO NO SELECT

CAIOHSZA 14/09/2012 09:54:33
#409672
TENHOS ESSES DOIS SELECT, POREM PRECISO SUBTRAIR O SELECT 2 DO SELECT 1.

SELECT 1 - SELECT SUM (FN06VRTITU) FROM FN06T WHERE fn06dtvenc >= [ô]01/08/2012[ô] AND fn06dtvenc <= [ô]31/08/2012[ô] AND fn06ccli1 IN (SELECT fi15codcf FROM fi15t WHERE FI15TIPOCL = [ô]200[ô]AND FI15EMP05 = [ô]1[ô]);

SELECT 2 - SELECT SUM (fn06vrtitu) FROM FN06T WHERE fn06ccli1= [ô]3025[ô] AND fn06dtvenc >= [ô]01/08/2012[ô] AND fn06dtvenc <= [ô]31/08/2012[ô];
KERPLUNK 14/09/2012 11:09:20
#409683
select (SELECT SUM (FN06VRTITU) FROM FN06T WHERE fn06dtvenc >= [ô]01/08/2012[ô] AND fn06dtvenc <= [ô]31/08/2012[ô] AND fn06ccli1 IN (SELECT fi15codcf FROM fi15t WHERE FI15TIPOCL = [ô]200[ô]AND FI15EMP05 = [ô]1[ô]) - (SELECT SUM (fn06vrtitu) FROM FN06T WHERE fn06ccli1= [ô]3025[ô] AND fn06dtvenc >= [ô]01/08/2012[ô] AND fn06dtvenc <= [ô]31/08/2012[ô])
Tópico encerrado , respostas não são mais permitidas