The NOT EXISTS is not working the same way as IN look the example bellow:
After beautifier became this :
I dont like also the way it formats the DISTINCT clause, can we change it?
Code:
SELECT DISTINCT
TA.FIELD_1,
TA.FIELD_2,
SUM(TB.FIELD_2) TOTAL
FROM TABLE_A TA,
TABLE_B TB
WHERE TA.FIELD_1 = TB.FIELD_1
AND NOT EXISTS (SELECT 1
FROM TABLE_C TC
WHERE TC.FIELD_2 = TA.FIELD_2)
AND TA.FIELD_1 IN (SELECT TD.FIELD_1
FROM TABLE_D TD)
GROUP BY TA.FIELD_1,
TA.FIELD_2
Code:
SELECT DISTINCT TA.FIELD_1,
TA.FIELD_2,
SUM(TB.FIELD_2) TOTAL
FROM TABLE_A TA,
TABLE_B TB
WHERE TA.FIELD_1 = TB.FIELD_1
AND NOT EXISTS (SELECT 1
FROM TABLE_C TC
WHERE TC.FIELD_2 = TA.FIELD_2)
AND TA.FIELD_1 IN (SELECT TD.FIELD_1
FROM TABLE_D TD)
GROUP BY TA.FIELD_1,
TA.FIELD_2