uid | created_date | user_id |
---|---|---|
1 | 2023-07-05 05:50:00.000 | 1 |
2 | 2023-07-05 06:50:00.000 | 1 |
3 | 2023-07-05 06:50:00.000 | 1 |
4 | 2023-07-05 06:40:46.000 | 2 |
5 | 2023-07-05 06:57:46.000 | 2 |
6 | 2023-07-05 06:43:46.000 | 2 |
For example, above is the data.
I am looking for output to have something like this
uid | created_date | user_id | reason |
---|---|---|---|
3 | 2023-07-05 06:50:00.000 | 1 | as date is same I chose latest uid |
5 | 2023-07-05 06:57:46.000 | 2 | choosing the latest date |