SQL Server select first instance of ranked data

sql, sql-server

Solution

SELECT MIN(Rank) AS Rank, Name
FROM TableName
GROUP BY Name

Problem

I have a query that creates a result set like this: ``` Rank Name 1 Fred 1 John 2 Mary 2 Fred 2 Betty 3 John 4 Betty 4 Frank ``` I need to then select the lowest rank for each name, e.g.: ``` Rank Name 1 Fred 1 John 2 Mary 2 Betty 4 Frank ``` Can this be done within TSQL?

Original source