Q:

SQL IN or EXISTS clause issue

I have two separate queries that I'd like to combine but I'm struggling to get the result I'd like.  One summarizes all the values in the table and another selects duplicate rows based on the most recent date. 
A shortened version of the first query is:
SELECT a.PLANT_NO "PlantNumber", 
       SUM(CASE WHEN a.REC_STATUS_CD = 'RR' THEN -a.KW_CTR_REDELIVERED_HV 
                ELSE a.KW_CTR_REDELIVERED_HV END) "KeepWholeResidueMMBtu", 
       SUM(a.ETH_APPLIED_POP_PCT + a.ISO_APPLIED_POP_PCT  + 
           (CASE WHEN a.PLANT_NO = '002' THEN a.ALTLIQ_APPLIED_POP_PCT ELSE 0 END)
          )/100 "NGLPOPPaymentPercent"
FROM GAS_STMT a 
INNER JOIN SETTLE_SUMMARY c
   ON CASE WHEN SUBSTR(a.TRNX_ID,1,1) = '-' 
           THEN SUBSTR(a.TRNX_ID, 2, LENGTH(a.TRNX_ID)) 
           ELSE CAST(a.TRNX_ID AS VARCHAR2(100)) 
      END = c.TRNX_ID
  AND a.MTR_NO||a.MTR_SFX = c.MTR_NO||c.MTR_SFX
WHERE TO_CHAR(a.PROD_DT, 'YYYY')  >= TO_CHAR(ADD_MONTHS(SYSDATE, -36), 'YYYY') 
  AND a.STATUS_UNIT_TM_CD = 'M' 
GROUP BY a.PLANT_NO
ORDER BY a.PLANT_NO

The other query is used to filter out four transactions based on the most recent transaction date.
SELECT a.*
FROM GAS_STMT a,
     (SELECT MTR_NO,MTR_SFX,TRNX_ID,REC_STATUS_CD,MAX(ACCT_DT) ACCT_DT
      FROM GAS_STMT
      WHERE REC_STATUS_CD = 'RR'
      GROUP BY MTR_NO, MTR_SFX, TRNX_ID, REC_STATUS_CD
      HAVING COUNT(TRNX_ID) > 1) b
WHERE a.MTR_NO = b.MTR_NO
  AND a.TRNX_ID = b.TRNX_ID AND a.REC_STATUS_CD = b.REC_STATUS_CD
  AND a.ACCT_DT = b.ACCT_DT

I would think that I could use where NOT IN or NOT EXISTS to have the first query sum everything except for those four records excluded in the second query.
Using EXISTS I get the same result as the first query by itself and using NOT EXISTS I get no results.  When I use IN I get a sum of the excluded records which is the opposite of what I want.
Is there a good way to do this in PL/SQL?  I'm confused that I'm not getting any records for the NOT EXISTS query.
Example of first query results:

Plant_No - Sum
002  - 100
450  - 50
500  - 50

Example of second query results:

Trnx_ID - Plant_no - KW_CTR_REDELIVERED_HV
1234  - 002  - -.99
1235  - 002  - -.99

Intended result:

Plant_No - Sum
002  - 98.02
450  - 50
500  - 50

A:

If you want to exclude the records returned by the second query, try:
SELECT a.PLANT_NO "PlantNumber", 
       SUM(CASE WHEN a.REC_STATUS_CD = 'RR' THEN -a.KW_CTR_REDELIVERED_HV 
                ELSE a.KW_CTR_REDELIVERED_HV END) "KeepWholeResidueMMBtu", 
       SUM(a.ETH_APPLIED_POP_PCT + a.ISO_APPLIED_POP_PCT  + 
           (CASE WHEN a.PLANT_NO = '002' THEN a.ALTLIQ_APPLIED_POP_PCT ELSE 0 END)
          )/100 "NGLPOPPaymentPercent"
FROM GAS_STMT a 
INNER JOIN SETTLE_SUMMARY c
   ON CASE WHEN SUBSTR(a.TRNX_ID,1,1) = '-' 
           THEN SUBSTR(a.TRNX_ID, 2, LENGTH(a.TRNX_ID)) 
           ELSE CAST(a.TRNX_ID AS VARCHAR2(100)) 
      END = c.TRNX_ID
  AND a.MTR_NO||a.MTR_SFX = c.MTR_NO||c.MTR_SFX
LEFT JOIN (SELECT MTR_NO,MTR_SFX,TRNX_ID,REC_STATUS_CD,MAX(ACCT_DT) ACCT_DT
           FROM GAS_STMT
           WHERE REC_STATUS_CD = 'RR'
           GROUP BY MTR_NO, MTR_SFX, TRNX_ID, REC_STATUS_CD
           HAVING COUNT(TRNX_ID) > 1) b
   ON a.MTR_NO = b.MTR_NO 
  AND a.TRNX_ID = b.TRNX_ID 
  AND a.REC_STATUS_CD = b.REC_STATUS_CD 
  AND a.ACCT_DT = b.ACCT_DT
WHERE TO_CHAR(a.PROD_DT, 'YYYY')  >= TO_CHAR(ADD_MONTHS(SYSDATE, -36), 'YYYY') 
  AND a.STATUS_UNIT_TM_CD = 'M' 
  AND b.MTR_NO IS NULL
GROUP BY a.PLANT_NO
ORDER BY a.PLANT_NO

