I have a sample table as follows.
ID Name Code Address
----+---------------+--------+----------------
1 | Sydney Hall | SH | 11 Abc Street
2 | Sydney Hall | SH | 23 Abc Street
3 | Main Hall | MH | 74 Xyz Street
4 | Odyssey Hall | OH | 133 AbZ Street
5 | Odyssey Hall | OH | 28 Xyx Street
I would like to select distinct Code entries as well as ID and Name for these distinct entries. For the table above I would like to get the following (so I am ignoring the building addresses).
ID Name Code
----+---------------+--------+
1 | Sydney Hall | SH
3 | Main Hall | MH
4 | Odyssey Hall | OH
It's probably a Left Join but I can't seem to put it together properly (especially since I'm selecting data from the same table). Does any one have an idea about this? Thanks.