WITH cte AS (SELECT *, ROW_NUMBER() OVER (PARTITION BY list_id ORDER BY list_id DESC) AS rn FROM Products WHERE CategoryID in (select * from category_list)SELECT * FROM cte WHERE rn = 1 and category='couple' order by cartid;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)