How to from this table
Name Code
ABC Code1
DEF Code1
GHI Code2
JKL Code2
OMN Code3
get this result:
Name Code
ABC Code1
GHI Code2
OMN Code3
Is there any simple solution?
How to from this table
Name Code
ABC Code1
DEF Code1
GHI Code2
JKL Code2
OMN Code3
get this result:
Name Code
ABC Code1
GHI Code2
OMN Code3
Is there any simple solution?
I considered that you want your results to be alphabetical.
SELECT
MIN(Name), Code
FROM
MyTable
GROUP BY
Code
if your "TOP" is defined by "first in alphabtetical order", you could simply use a simple group by clause with the MIN aggregation.
SELECT MIN(Col1), Col2 FROM table GROUP BY Col2
otherwise, you will need another column, such as an incrementing uniqueid or a creation date.