I'm running a command to retrieve all rows for today with IDs matching 1, 2, 3, etc.
I want to retrieve the latest entry for these IDs for today though.
So rather than getting:
BinID | Timestamp |
2 | 29/04/2021 3:49pm
2 | 29/04/2021 4:41pm
3 | 29/04/2021 2:24pm
I want:
BinID | Timestamp |
2 | 29/04/2021 4:41pm
3 | 29/04/2021 2:24pm
Is this possible?
This is the command I'm running at the moment.
MySqlCommand mysqlcom = new MySqlCommand("SELECT * FROM realtime_gpses WHERE BinId IN (" + binIdsCSVString + ") AND Timestamp >= CURDATE() AND Timestamp < CURDATE() + INTERVAL 1 DAY", mysqlcon);
where binIdsCSVString
in this cases is just 2, 3.