Question: SQL query to best get the desired result below.
Input:
| Identifier | Date |
|---|---|
| 1234 | 2022-01-01 |
| 1234 | 2022-08-11 |
| 7890 | 2022-08-11 |
| 4444 | 2022-08-13 |
Output:
| Identifier | Date |
|---|---|
| 7890 | 2022-08-11 |
| 4444 | 2022-08-13 |
Note: Want only new entries that was not in the past. Tried doing a self left join with the same table with a.Identifier = b.Identifier and a.date < b.date but it gives me 1234 entry that I do not need.
My Query (Yielding extra entry of 1234)
select * from
Table a left join Table b
on a.Identifier = b.Identifier
and a.Date < b.Date
where b.Identifier is null
