當前位置:首頁 » 編程語言 » sqlserver列轉行

sqlserver列轉行

發布時間: 2023-03-01 21:31:08

A. sql 列轉行

CREATE TABLE T1(A NUMBER,
b NUMBER,
c NUMBER,
d NUMBER,
e NUMBER);
insert into t1 values(1,2,3,4,5);
select * from t1;
select decode(A,1,'A',null) KEY ,decode(A,1,1,null) VALUE
from t1
union all
select decode(B,2,'B',null),decode(B,2,2,null)
from t1
union all
select decode(C,3,'C',null),decode(C,3,3,null)
from t1
union all
select decode(D,4,'D',null),decode(D,4,4,null)
from t1
union all
select decode(E,5,'E',null),decode(E,5,5,null)
from t1;

熱點內容
tnt蘋果核安卓怎麼加好友 發布:2025-07-15 09:05:15 瀏覽:238
年輕人運行內存為什麼比安卓好 發布:2025-07-15 08:52:03 瀏覽:514
怎麼配置組策略 發布:2025-07-15 08:52:02 瀏覽:245
pythonjson格式 發布:2025-07-15 08:42:54 瀏覽:677
醫院葯房要什麼配置 發布:2025-07-15 08:29:55 瀏覽:665
編程說明書 發布:2025-07-15 08:16:39 瀏覽:760
android請求超時 發布:2025-07-15 07:56:57 瀏覽:530
修改linux的主機名 發布:2025-07-15 07:52:46 瀏覽:907
天龍八部自動挖礦腳本怎麼寫 發布:2025-07-15 07:42:01 瀏覽:648
本地編譯器怎麼運行 發布:2025-07-15 07:42:00 瀏覽:995