You can try to perform a nested search between the minimum grouping and the source table.
It looks like a trick
SELECT MinPlaces.Code, MinPlaces.Distance, Places.Location FROM Places INNER JOIN ( SELECT Code, MIN(Distance) AS Distance FROM Places GROUP BY Code HAVING MIN(Distance) > 0 ) AS MinPlaces ON Places.Code = MinPlaces.Code AND Places.Distance = MinPlaces.Distance ORDER BY MinPlaces.Distance ASC
UPDATE . Tested using the following:
DECLARE @Places TABLE ( Code INT, Distance FLOAT, Location VARCHAR(50) ) INSERT INTO @Places (Code, Distance, Location) VALUES (106, 386.895834130068, 'New York, NY'), (80, 2116.6747774121, 'Washington, DC'), (80, 2117.61925131453, 'Alexandria, VA'), (106, 2563.46708627407, 'Charlotte, NC') SELECT MinPlaces.Code, MinPlaces.Distance, P.Location FROM @Places P INNER JOIN ( SELECT Code, MIN(Distance) AS Distance FROM @Places GROUP BY Code HAVING MIN(Distance) > 0 ) AS MinPlaces ON P.Code = MinPlaces.Code AND P.Distance = MinPlaces.Distance ORDER BY MinPlaces.Distance ASC
And it gives:

source share