You can also use Row_Number to do this..CREATE TABLE #temp(Shop int,Product INT,Color varchar(100),[Type] int)INSERT INTO #tempSELECT 001,12345,'White',1 UNION ALLSELECT 001,23456,'White',1 UNION ALLSELECT 001,34567,'White',1 UNION ALLSELECT 001,45678,'Blue',1 UNION ALLSELECT 001,56789,'Blue',1 UNION ALLSELECT 001,67890,'Blue',1 UNION ALLSELECT 001,78901,'White',2 UNION ALLSELECT 001,89012,'White',2 UNION ALLSELECT 001,90123,'White',2 UNION ALLSELECT 001,01234,'Blue',2 UNION ALLSELECT 001,12356,'Blue',2 UNION ALLSELECT 001,23456,'Blue',2SELECT Shop ,Product ,Color ,[Type] FROM (SELECT * ,RowNum = ROW_NUMBER() OVER (PARTITION BY [Type],color ORDER BY (SELECT 1)) FROM #temp) a WHERE a.RowNum IN (1,2)
---------------Murali KrishnaYou live only once ..If you do it right once is enough.......