Code:
select c.name, p.productid, p.name, isnull(pv.name, '') VariantName, p.description, p.sename, p.ImageFileNameOverride, p.SKU, isnull(p.FroogleDescription, '') ProductFroogleDescription, p.SEKeywords,
p.ManufacturerPartNumber, pv.price, isnull(pv.saleprice, 0) saleprice, isnull(pv.FroogleDescription, '') VariantFroogleDescription, isnull(pv.description, '') VariantDescr, pv.Condition,
ROW_NUMBER() OVER (ORDER BY p.productid) AS ROW
from dbo.product p
join dbo.productvariant pv on p.productid = pv.productid
left join (select variantid, sum(quan) inventory from dbo.inventory group by variantid) i on pv.variantid = i.variantid
join ProductCategory pc on pc.ProductID = p.ProductID
join Category c on pc.CategoryID = c.CategoryID
where p.IsSystem=0
and p.deleted = 0
and p.published = 1
and p.ExcludeFromPriceFeeds = 0
and pv.isdefault = 1