select b.StoreID,b.StoreName,b.SaleAreaName,b.ContactName,b.Tel,b.StoreTypeName,b.OrderCount,
b.Price,b.ProductName,b.BrandID,b.BrandName,
b.ProductID, b.UserName,b.CheckTime
from (select a.StoreID,
a.StoreName,
a.SaleAreaName,
a.ContactName,
a.Tel,
a.StoreTypeName,
a.OrderCount,
a.Price,a.ProductName,a.BrandID,a.BrandName,
a.ProductID,
a.CheckTime,
a.UserName,
-- count(1) over(partition by a.StoreID) as count_id,
-- count(1) over(partition by a.StoreID, a.ProductID) as count_price,
row_number() over(partition by a.StoreID, a.ProductID order by a.CheckTime desc) as row_c
from VTBasProductBrand a) b
where b.row_c = 1
b.Price,b.ProductName,b.BrandID,b.BrandName,
b.ProductID, b.UserName,b.CheckTime
from (select a.StoreID,
a.StoreName,
a.SaleAreaName,
a.ContactName,
a.Tel,
a.StoreTypeName,
a.OrderCount,
a.Price,a.ProductName,a.BrandID,a.BrandName,
a.ProductID,
a.CheckTime,
a.UserName,
-- count(1) over(partition by a.StoreID) as count_id,
-- count(1) over(partition by a.StoreID, a.ProductID) as count_price,
row_number() over(partition by a.StoreID, a.ProductID order by a.CheckTime desc) as row_c
from VTBasProductBrand a) b
where b.row_c = 1