*第一关
SELECT concat(substr(attr,8,2),substr(attr,3,2)) str FROM LEVEL1
-
第二关
SELECT ' chart ' AS chart UNION ALL
SELECT '--------------------' AS chart UNION ALL
SELECT chart FROM (
SELECT concat (LPAD(js :: TEXT,2,'0'),' ','|',' ',COALESCE (MIN (gou),' '),' ',COALESCE (MIN (qing),' '),' ',COALESCE (MIN (kuai),' '),' ',COALESCE (MIN (lei),' '),' ') AS chart,LPAD(js :: TEXT,2,'0') seNo FROM (
SELECT ROW_NUMBER () OVER (PARTITION BY attr ORDER BY attr) js,CASE WHEN attr='国' THEN '国' END gou,CASE WHEN attr='庆' THEN '庆' END qing,CASE WHEN attr='快' THEN '快' END kuai,CASE WHEN attr='乐' THEN '乐' END lei FROM level2) tmp GROUP BY js ORDER BY seNo DESC) tmp UNION ALL
SELECT '--------------------' UNION ALL
SELECT ' 2022-10-01 '