I have a table with account numbers and dates (amoung other columns). For each account number there are multiple entries with different dates. I want to return only the row with the most recent date and only account numbers that I have from another source.
This is what I've tried but I understand why this doesn't work. I just can't think of an alternative approach.
SELECT ACCOUNT_NUMBER, MAX(DATE) FROM PORTFOLIO WHERE ACCOUNT_NUMBER IN (444347, 899999, 887111, 220922) GROUP BY ACCOUNT_NUMBER