Home Forums SQL Server 2008 T-SQL (SS2K8) find a grouping with at least one row within the group containing a certain value RE: find a grouping with at least one row within the group containing a certain value
Smash125
Hall of Fame
Points: 3562
More actions
August 29, 2012 at 12:19 am
#1531216
--Check this
SELECT Name,TYPE,Price FROM
(SELECT Name, [TYPE], Price
,ROW_NUMBER() OVER (PARTITION BY NAME ORDER BY PRICE DESC) AS N FROM @t) AS A
WHERE N=1