要求统计的时候要统计上半年下半年和全年
用sql语句可以控制吗?

解决方案 »

  1.   

    >=1,<=6不就是上半年么
    >=7,<= 12就是下半年了
      

  2.   

    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