with CTE as ( select CouponsStock.CouponsID, ProdSubCatItemsDescription.Items_Desc_ShortDescription, ROW_NUMBER() over(PARTITION BY CouponsStock.CouponsID, ProdSubCatItemsDescription.Items_Desc_ShortDescription order by ProdSubCatItemsDescription.Items_Desc_ShortDescription )as Cnt from category inner join ProductCategory on category.Cat_ID=ProductCategory.Cat_ID inner join ProductSubCategory on ProductCategory.Prod_Cat_ID=ProductSubCategory.Prod_Cat_ID inner join ProductSubCatItmes on ProductSubCategory.Prod_Sub_Cat_ID=ProductSubCatItmes.Prod_Sub_Cat_ID inner join ProdSubCatItemsDescription on ProductSubCatItmes.Prod_Sub_Cat_Items_ID=ProdSubCatItemsDescription.Prod_Sub_Cat_Items_ID inner join CouponsStock on ProdSubCatItemsDescription.Prod_Sub_Cat_Items_Desc_ID=CouponsStock.Prod_Sub_Cat_Items_Desc_ID where category.Cat_Name='Fashion' and ProdSubCatItemsDescription.Items_Desc_Status<>'Disabled' and CouponsStock.CouponsEndDate>=GETDATE() and CouponsStock.CouponsStatus='Visible' ) select CouponsID, Items_Desc_ShortDescription from CTE where Cnt=1
16 KRIAA - Men's Handloom Embroidery Short Kurti ( TTMK 4011 ) 17 KRIAA - Men's Handloom Embroidery Short Kurti ( TTMK 4011 ) 39 Crosscreek Fil-A-Fil Casual Shirt 46 Live Life Colorful : Western Wear..... 47 50% Off For Select Time Period
KRIAA - Men's Handloom Embroidery Short Kurti ( TTMK 4011 )
CouponsID
16
17
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)