This has been inexplicably hard to figure out... I have grouped together my sales into a query & it returns results similar to the table below. It has the SKU, Sale price grouped & the amount of instances of that group.I want to select only the SKU & Sale price for the instance with the maximum value... It seems easy enough, but every time I add something to the query or sub query, I violate one rule or another.Declare @Temp Table( Id Int Identity(1,1) , Sku nvarchar(500) , SalePrice decimal(18,2) , [Instances] [int] )Insert into @Temp Values('ABCD','11.29',5)Insert into @Temp Values('ABCD','11.97',2)Insert into @Temp Values('ABCD','11.49',3)Insert into @Temp Values('ASDFCD','17.09',5)Insert into @Temp Values('ASDFCD','16.99',4)Insert into @Temp Values('ESRTG','17.49',8)Insert into @Temp Values('ESRTG','17.99',2)Insert into @Temp Values('ESRTG','18.89',44)Insert into @Temp Values('ESRTG','18.95',4)Select SKU, SalePrice, InstancesFrom @Temp
-SergioI use Microsoft SQL 2008