不可能吧 如果用pivot 其实和 上面聚合的是一样的。with t1(
time, jc , model) as
(select '2017/11/15', 6 ,0.5 from dual union all
select '2017/11/15' , 1, 0.8 from dual union all
select '2017/11/15', 3 ,1.5 from dual union all
select'2017/11/16' , 1 ,0.8 from dual union all
select '2017/11/16' ,1 ,1 from dual union all
select '2017/11/17' ,3, 0.8 from dual union all
select'2017/11/17' ,3 ,1 from dual union all
select '2017/11/17' ,3 ,1.5 from dual)
/*select time,nvl(max( case when model='0.5'then jc else 0 end),0) as "0.5",
nvl(max( case when model='0.8' then jc else 0 end),0) as "0.8",
nvl(max( case when model='1' then jc else 0 end),0) as "1",
nvl(max( case when model='1.5' then jc else 0 end),0) as "1.5" from t1 group by time order by time asc */
select * from t1
pivot(max(jc) for model in(0.5,0.8,1,1.5)) kk
order by time asc
/*
TIME 0.50.811.5
12017/11/15613
22017/11/1611
32017/11/17333
*/
两种写法都可以