加上辅助列 然后写上每个季度,然后union all
SELECT A.季度 AS 季度,A.report_date AS report_date
FROM
(--第一季度
SELECT DISTINCT
'第一季度' as 季度,
report_date
FROM
eva_norm_report
WHERE
substr(report_date, 1, 4) = '2022'
and substr(report_date,5,6) between '01 ' and '03'
union all
--第二季度
SELECT DISTINCT
'第二季度' as 季度,
report_date
FROM
eva_norm_report
WHERE
substr(report_date, 1, 4) = '2022'
and substr(report_date, 5, 6) between '04' and '06'
union all
--第三季度
SELECT DISTINCT
'第三季度' as 季度,
report_date
FROM
eva_norm_report
WHERE
substr(report_date, 1, 4) = '2022'
and substr(report_date, 5, 6) between '07' and '09'
union all
--第四季度
SELECT DISTINCT
'第四季度' as 季度,
report_date
FROM
eva_norm_report
WHERE
substr(report_date, 1, 4) = '2022'
and substr(report_date, 5, 6) between '10' and '12') A
where 季度 = '第一季度'