首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

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

2012-04-03 
分组求最大日期按客户编号分组取最大时间[解决办法]select *from(select row_number()over(partition by

分组求最大日期
按客户编号分组取最大时间

[解决办法]
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)

热点排行