ITEMS PRODUCT DATE ------------------------------------------------- mobile nokia 01/10/2012 mobile nokia 02/10/2012 mobile nokia 03/10/2012 bottle water 05/10/2012 bottle water 06/10/2012 pen blackpen 08/10/2012 pen blackpen 09/10/2012 pen blackpen 12/10/2012
ITEMS PRODUCT DATE ------------------------------------------------- mobile nokia 03/10/2012 bottle water 06/10/2012 pen blackpen 12/10/2012
select Items,Product,max(date) from Tablename group by Items,Product
SELECT ITEMS,PRODUCT,Date FROM (SELECT ITEMS,PRODUCT,Date, ROW_NUMBER() OVER(PARTITION BY ITEMS,PRODUCT ORDER BY Date) As ROWNUM FROM tbl ) AS A WHERE A.ROWNUM = 2
select Item,Product,max(date) from tbl group by Item,Product
select * from Tablename order by DATE Asc
select Items,Product,max(MYdate) from Tablename group by Items,Product
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)