欲同一列的值連接成單獨的列級聯列的值轉換成單獨的列
假設有列稱爲類型和文本
TYPES TEXT
A This is a
B This is b
C This is c
我想所需的輸出爲:
Con
This is c | This is a
This is c | This is b
欲同一列的值連接成單獨的列級聯列的值轉換成單獨的列
假設有列稱爲類型和文本
TYPES TEXT
A This is a
B This is b
C This is c
我想所需的輸出爲:
Con
This is c | This is a
This is c | This is b
我認爲自加入表可以幫助你:
這是僞代碼
select t.text || tb.text || tc.text
from t
inner join t tb using(types)
inner join t tc using(types)
所以,來連接A和C柱,你可以嘗試以下操作:
select t.text || tc.text
from t
full outer join t tc using(types)
where t.types = 'A' and tc.types = 'C'
select concat(t1.text ,' | ', t2.text) from tablename t1
inner join tablename t2
on t1.types <> t2.types
什麼是你嘗試的事情?此外,您的問題仍然顯得模糊 – Pratik
請解釋並格式化您的問題 – slesh
您如何確定要連接的值? – jarlh