日期:2014-05-17 浏览次数:20901 次
with test as(
select 'a' name,'1' age from dual union all
select 'a','' from dual union all
select 'b','1' from dual union all
select 'b','' from dual union all
select 'c','1' from dual)
select name,max(age),um(age) from test group by name
with t as你不就是上面的意思么
(select '001' code, '' name from dual
union all
select '001', '张三' from dual
union all
select '002', '李四' from dual
union all
select '002', '' from dual
union all
select '003', '' from dual)
select code, max(name) from t group by code order by code