How do I select all entries that have the same Type as the entry with the largest Date?
I'm using SQL Server.
My table:
+----+------+-------------------------+
| id | Type | Date |
+----+------+-------------------------+
| 1 | xxx | 2020-02-25 09:11:53.000 |
| 2 | yyy | 2020-02-25 08:30:35.000 |
| 3 | xxx | 2020-02-25 07:48:17.000 |
| 4 | xxx | 2020-02-25 09:04:25.000 |
| 5 | yyy | 2020-02-25 07:59:03.000 |
The result should be:
+----+------+-------------------------+
| id | Type | Date |
+----+------+-------------------------+
| 1 | xxx | 2020-02-25 09:11:53.000 |
| 3 | xxx | 2020-02-25 07:48:17.000 |
| 4 | xxx | 2020-02-25 09:04:25.000 |
+----+------+-------------------------+
Because id =1 is the Type with the max Date.