1.第一种方法 查询最大的数据分组之后链表查询
select * from Warehouse_Information t  inner join 
(select f.Products_Id,MAX(DATA0) datas from Warehouse_Information f Group by f.Products_Id) k on t.Products_Id=k.Products_Id and k.datas =t.DATA0



2.第二种方法 排序方法
select * from
(
  SELECT t.*,ROW_NUMBER() over (partition by t.Products_Id order by t.DATA0 desc) numm
  FROM Warehouse_Information t  where t.DATA0 in (select MAX(f.DATA0) 
from Warehouse_Information f Group by  f.Products_Id)
) a
where numm=1
Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐