1
我想串聯一個列的值,但這些值必須格式化爲另一個字符串。連接列值
這裏是我的表:
C1 C2 c3 c4
--------- --------- ------ --------
ID1 28-OCT-16 11.59.00 (null) 04-OCT-16 08.48.00
ID2 (null) 05-OCT-16 02.55.00 (null)
ID3 (null) 10-OCT-16 04.32.00 21-OCT-16 02.25.00
ID4 10-OCT-16 04.32.00 18-OCT-16 08.52.00 18-OCT-16 08.32.00
ID5 10-OCT-16 04.32.00 (null) (null)
我已經完成格式化表格來匹配我需要的價值。
select
c1 T_ID,
case when c2 is not null then 'Plane' end PLANE,
case when c3 is not null then 'BUS' end BUS,
case when c4 is not null then 'Hotel' end HOTEL
from table1
order by 1;
T_ID PLANE BUS HOTEL
--------- --------- ------ --------
ID1 Plane (null) Hotel
ID2 (null) BUS (null)
ID3 (null) BUS Hotel
ID4 Plane BUS Hotel
ID5 Plane (null) (null)
而且我嘗試做以下
T_ID SERVICE
--------- ---------
ID1 Plane+Hotel
ID2 BUS
ID3 BUS+Hotel
ID4 Plane+BUS+Hotel
ID5 Plane
我試過一對夫婦級聯功能,但無法找到我要找的結果。
「我試過幾個串接函數」 - 你有什麼試過?什麼不行? –
向我們展示你在找什麼結果請 –