greatest n per group - SQL Server query to select local maximums -
I have this data, I need to get minimum $ full lines for each person. Date of date zodiac $ 123 Jun 1 Peter $ 120 Jun 5 Peter $ 123 Jun 5 Paul $ 100 Jun 1 Paul $ 220 Jun 3 Paul The result of the SQL Server query should be: $ 120 June 5 Peter $ 100 June 1 Paul class = "post- Text "itemprop =" text "> SQL Server 2005+ Edition ; Select as CTE (select amount, [Date], name, ROW_NUMBER (), (Order number [quantity] by the participant] AS RowNum from the table * Select from CTE where Row name = 1 Alternate versions SELECT t zodiac, t. [Date], T. Name in the table (name of the selection, the least amount of name by the table group as the minimum), in the table T at INNER. Name = m.Name and t.Amount = m.Amount