日期:2014-05-17 浏览次数:20920 次
select user_id,name,max(time) from a group by user_id,name
------解决方案--------------------
create table a (user_id number(8), name varchar2(20), time date); insert into a values(33,'www',to_date('2010-07-08','yyyy-mm-dd')); insert into a values(33,'www',to_date('2010-06-07','yyyy-mm-dd')); insert into a values(33,'www',to_date('2010-05-06','yyyy-mm-dd')); insert into a values(44,'www',to_date('2010-05-07','yyyy-mm-dd')); insert into a values(44,'www',to_date('2010-06-25','yyyy-mm-dd')); create table b (user_id number(8), name varchar2(20), time date); insert into b ( select user_id,name,max(time) from a group by user_id,name);
------解决方案--------------------