In SQL 2005 and later, I usually use Row_Number and a CTE to do that.
Something like this:
;
WITH CTE
AS (SELECT [Last Name],
[First Name],
[Building Desc],
[Sub Plan Desc],
[Sub Plan Cat Desc],
ROW_NUMBER() OVER (PARTITION BY [Last Name],
[First Name], [Building Desc] ORDER BY [Sub Plan Desc], [Sub Plan Cat Desc]) AS Row
FROM dbo.Benefit)
SELECT [Last Name],
[First Name],
[Building Desc],
[Sub Plan Desc],
[Sub Plan Cat Desc]
FROM CTE
WHERE Row = 1 ;
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon