I have an mssql table with this format:

```

ID  |Code   |Name   |Date
1   |01     |A      |2011-01-01 00:01:23
2   |02     |B      |2011-07-01 00:01:23
3   |01     |A      |2011-05-01 00:01:23
4   |01     |A      |2011-07-01 00:01:23
5   |03     |C      |2011-02-01 00:01:23
6   |04     |D      |2011-01-01 00:01:23
7   |03     |C      |2011-01-01 00:01:23
8   |02     |B      |2011-01-01 00:01:23

I need to select unique code with with latest date as follows:

ID  |Code   |Name   |Date
1   |01     |A      |2011-07-01 00:01:23
2   |02     |B      |2011-07-01 00:01:23
3   |03     |C      |2011-02-01 00:01:23
4   |04     |D      |2011-01-01 00:01:23

```

How do I write an sql query to achieve this?