I am trying to see the total records remaining to count subtracting the records that have been received this year. below is the SQL i am using and i get the same number of records with out excluding the records that were received this year
example
what i am seeing using my current SQL 21 records 6 received this year column should read 15 records but it is still reading 21 records
SUM(CASE WHEN RECEIPT_DATE > to_date( '#START_OF_THIS_YEAR#', 'YYYY-MM-DD-HH24:MI:SS' ) and LAST_COUNT_DATE > trunc(to_date( '#START_OF_THIS_YEAR#', 'YYYY-MM-DD-HH24:MI:SS' )) + ( 1 - 1/ ( 60*60*24 ) )THEN '0' ELSE '1' END)
Thank you for any help