查询前
name age
a
a 1
b 1
b
c 1
查询后
name age
a 1
b 1
c
哪位大哥知道这个sql语句怎么写呀 谢了啊
------解决方案--------------------
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