开发者

How can i change a horizontal sql table to a vertical?

开发者 https://www.devze.com 2022-12-07 21:34 出处:网络
Here is what the table looks like SELECT season, TO_CHAR(score_0_0/380.00*100, \'fm00D00%\') AS perct_0_0,

Here is what the table looks like

SELECT
season,
TO_CHAR(score_0_0/380.00*100, 'fm00D00%') AS perct_0_0,
TO_CHAR(score_1_0/380.00*100, 'fm00D00%') AS perct_1_0,
TO_CHAR(score_1_1/380.00*100, 'fm00D00%') AS perct_1_1,
TO_CHAR(score_2_0/380.00*100, 'fm00D00%') AS perct_2_0,
TO_CHAR(score_2_1/380.00*100, 'fm00D00%') AS perct_2_1,
TO_CHAR(score_2_2/380.00*100, 'fm00D00%') AS perct_2_2,
TO_CHAR(score_3_1/380.00*100, 'fm00D00%') AS perct_3_1,
TO_CHAR(score_3开发者_Go百科_0/380.00*100, 'fm00D00%') AS perct_3_0,
TO_CHAR(score_4_0/380.00*100, 'fm00D00%') AS perct_4_0,
TO_CHAR(score_the_rest/380.00*100, 'fm00D00%') AS perct_the_rest
FROM
total_matches_score

ORDER BY season;

P/S : I have already used CTE to create total_matches_score table

I would like to convert the seasons rows to columns

0

精彩评论

暂无评论...
验证码 换一张
取 消