日期:2014-05-17 浏览次数:20763 次
wiht new_A as( select rowid,ID1 ID,RATE1 RATE from A union all select rowid,ID2 ,RATE2 from A union all select rowid,ID3 ,RATE3 from A union all select rowid,ID4 ,RATE4 from A union all select rowid,ID5 ,RATE5 from A) rowid 相同的就是同一条数据 select wm_concat(ID:||RATE||'%/') from (select rowid,ID,sum(NVL(RATE)) RATE from (select rowid,decode(ID,'X','Y') ID,RATE from new_A) group by rowid, ID) group by rowid 缺点wm_concat()连接,它不会按照排序的来。
------解决方案--------------------