例子**:
select scheme_id,ltrim(max(sys_connect_by_path(win_degreen||':'||win_number||'注',',')),',') win_degreen
from
(
select scheme_id,win_degreen,win_number,min(win_degreen) over(partition by scheme_id) win_degreen_min,
(row_number() over(order by scheme_id,win_degreen,win_number))+(dense_rank() over (order by scheme_id)) numid
from scheme_prize_record t
)
start with win_degreen=win_degreen_min connect by numid-1=prior numid
group by scheme_id;
迴圈陣列改變結構(橫向變縱向)
方法一 tbodyarr 150,73,20,140,90,40,newarr con newarr最終結果,con中間變數 for var m 0 m tbodyarr 0 length m newarr.push con console.log newarr 方法二 var alldataarr...
MSSQL SQL 查詢結果的縱向變橫向排列
create table booklibary 圖書館 varchar 10 科目 varchar 10 數量 int insert into booklibary select a 語文 5 union all select b 數學 6 union all select c 英語 3 union...
oracle 橫向列變為縱向列
很多業務需求儲存資料的時候都採取key value的形式,展示時則需要key1,key2,key3.展示 效果如下 sql語句如下 select round sum case when data item code backn52 then data item value else 0 end 2 ...