SELECT year ,'上半年'sum(rec_count) from table_1 where month >=1 and month <= group by year union all SELECT year ,'下半年',sum(rec_count) from table_1 where month >=7 and month <=12 group by year union all SELECT year ,'全年',sum(rec_count) from table_1 where group by year
>=7,<= 12就是下半年了
union all
SELECT year ,'下半年',sum(rec_count) from table_1 where month >=7 and month <=12 group by year
union all
SELECT year ,'全年',sum(rec_count) from table_1 where group by year