SUBTRACAO NO SELECT
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[ô];
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[ô];
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