I have a table with the following columns member_id, status and created_at (timestamp) and i want to extract the latest status for each member_id based on the timestamp value.
| member_id | status | created_at |
|---|---|---|
| 1 | ON | 1641862225 |
| 1 | OFF | 1641862272 |
| 2 | OFF | 1641862397 |
| 3 | OFF | 1641862401 |
| 3 | ON | 1641862402 |
So, my ideal query result would be like this:
| member_id | status | created_at |
|---|---|---|
| 1 | OFF | 1641862272 |
| 2 | OFF | 1641862397 |
| 3 | ON | 1641862402 |