第二关
SQL 脚本:
WITH zuguowansui AS (
SELECT concat(LPAD(rn::text, 2, '0'),' ','|',' ',COALESCE(min(guo),' '),' ',COALESCE(min(qing),' '),' ',COALESCE(min(kuai),' '),' ',COALESCE(min(le),' '),' ') as chart,
LPAD(rn::text, 2, '0'),
'|',
min(guo) "国",
min(qing) "庆",
min(kuai) "快",
min(le) "乐"
FROM (SELECT row_number() OVER (PARTITION BY attr ORDER BY attr) rn,
CASE WHEN attr = '国' THEN '国' END guo,
CASE WHEN attr = '庆' THEN '庆' END qing,
CASE WHEN attr = '快' THEN '快' END kuai,
CASE WHEN attr = '乐' THEN '乐' END le
FROM level2) zuguowansui
GROUP BY rn
ORDER BY 1 DESC, 2 DESC, 3 DESC, 4 DESC)
select ' chart ' as biaotou
union all
select '--------------------' as fengefuqi
union all
SELECT chart
from zuguowansui
union all
select '--------------------' fengefuzhi
union all
select ' 2022-10-01 ' guoqingjie
效果图: