日期:2014-05-18 浏览次数:20479 次
select t1.a,t1.b,t1.c from table t1 join (select a,max(b) as maxDate from table group by a) t2 on t1.a=t2.a and t1.b=t2.maxDate
------解决方案--------------------
select * from tb t where 字段b=(select max(字段b) from tb where 字段a=t.字段a)
------解决方案--------------------
select t.字段a,t.字段b,t.字段c from (select row_number() over(partition by 字段a order by 字段b desc) rn, 字段a,字段b,字段c from tab) t where t.rn=1
------解决方案--------------------
select * from table a where not exists(select 1 from table b where a.字段a=b.字段b and a.字段b<b.字段b )
------解决方案--------------------
select * from table where b in(select max(b) from table group by a)