Oracle分组查询后,获取最大值的记录
最近在写个分组查询获取最新时间戳的语句时,发现这样写挺受用的,分享之:
?
select * from test a where a.updatetime=(select max(b.updatetime) from test b where a.type=b.type)
?
ps:假设a是已经groupby之后的表。
发布时间: 2012-07-15 20:20:06 作者: rapoo
Oracle分组查询后,获取最大值的记录
最近在写个分组查询获取最新时间戳的语句时,发现这样写挺受用的,分享之:
?
select * from test a where a.updatetime=(select max(b.updatetime) from test b where a.type=b.type)
?
ps:假设a是已经groupby之后的表。