@aaaa果
1.
SELECT overlay(attr placing '' from 1 for 7)||substring(attr from 3 for 2) 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 (guo),' '),' ',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 guo,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 '