1.拼接多的值列 這是橫向憑借
=== 同一行數據 不同列的拼接===
SELECT RIP.P_TS ||','|| RIP.P_DT
FROM RI_PAY RIP where RIP.O_NBR='RI201503240002'
查詢結果: 1427185223921,2015-03-18
2.拼接多行數據
select wm_concat(P_TS) P_TS from RI_PAY RIP where RIP.O_NBR='RI201503240002' ;
查詢結果:1427185223921,1427185273713,1427185251760
還可以;替換 “,” replace(wm_concat(name),',','*****') ;就是用****替換原來的 ",";
select replace(wm_concat(P_TS),',','*****') P_TS from RI_PAY RIP where RIP.O_NBR='RI201503240002' ;
查詢結果: 1427185223921*****1427185273713*****1427185251760
3.在查詢結果的后面;每一行都加上固定值
select P_TS,'固定值' dd from RI_PAY RIP where RIP.O_NBR='RI201503240002' order by RIP.P_CRTDT desc
查詢結果:
1427185273713 固定值
1427185251760 固定值
1427185223921 固定值