I am comapring accid from previous month and current month.
IF accid existed in previous month, but does not exist in the current month
THEN 'Closed'. ELSE
IF accid did not exist last month but exists in the current month
THEN 'New'
ELSE
'Old'"
The following query is not working pls. advise!
select
CMN.accid as current_month,PMN.accid as prev_month,
case
when select PMN.accid from prev_month_table PMN minus select CMN.accid from current_month_table CMN then 'Closed'
when select CMN.accid from current_month_table CMN minus select accid from prev_month_table then 'New'
else 'Old'
end as acc_status
from current_month_table, prev_month_table