How do I get the number of rows of maximum creation dates?
Example data:
id|code|transaction_date |amount|record_status|creation_date
1 |0001|2021-12-10 00:00:00| 10.00|D |2021-12-10 00:00:00
2 |0001|2021-12-10 00:00:00| 10.00|D |2021-12-11 10:00:00
3 |0002|2021-12-11 00:00:00| 10.00|D |2021-12-11 00:00:00
4 |0002|2021-12-11 00:00:00| 10.00|D |2021-12-12 10:00:00
I want to get this:
id|code|transaction_date |amount|record_status|creation_date
2 |0001|2021-12-10 00:00:00| 10.00|D |2021-12-11 10:00:00
4 |0002|2021-12-11 00:00:00| 10.00|D |2021-12-12 10:00:00
I am trying this
SELECT * FROM table1
WHERE (SELECT max(creation_date) from table1 WHERE DATE(transaction_date) = '2021-12-10')
AND record_status = 'D';
But I won't be able to select a range of date like I want IN ('2021-12-10', 2021-12-11')