2016年7月11日 星期一

ORACLE 11 G 以上新功能. 把列中的欄文字, 加成一欄.

select rvv31 , listagg( rvv36,',')  WITHIN GROUP (ORDER BY rvv31) "PONO" , sum(rvv17) 六月庫入數量  from gwt.rvv_file, gwt.rvu_file where rvv01=rvu01  and rvuconf ='Y' and
 rvu03 >= to_date('2016/06/01','yyyy/MM/dd') and rvu03 < to_date('2016/07/01','yyyy/MM/dd')
 group by rvv31


機種料號清單.
select '<tr><td>' || imaud01 || '</td><td>'|| pono|| '</td></tr>'  from
(
select imaud01,  listagg( ima01,'</td><td>')  WITHIN  GROUP (ORDER BY imaud01) "PONO"  from  ima_file where ( ( ima01 like '01%' and substr(ima01,12,1) <>'0' ) or ima01 like '0T%'  ) and ima06 between '11' and '14'
group by imaud01
)
這東西所產生出來的資料可以加工後放到EXCEL 中. 並配合 indirect() 的東西來作.....

沒有留言:

張貼留言