当前位置: 代码迷 >> Sql Server >> 分组求最大日期,该怎么解决
  详细解决方案

分组求最大日期,该怎么解决

热度:66   发布时间:2016-04-27 13:52:14.0
分组求最大日期
按客户编号分组取最大时间

------解决方案--------------------
select *from(select row_number()over(partition by 客户编号 order by 日期) as number,* from table)a where number=1
------解决方案--------------------
select *from table a where 日期=(select max(date) from table b where a.id=b.id)
  相关解决方案