如果是直接取 就下面的 如果不是每月都有 可以构造一个月份表来关联select substr(v_date,1,6) v_year_month,sum(v_qty) v_s_qty from table group by substr(v_date,1,6)
select v_year_month,sum(v_qty) v_s_qty from ( select substr(v_date,1,6) v_year_month,v_qty from tablename where v_date between '201103' and '201210') goroup by v_year_month
from table
group by substr(v_date,1,6)
select substr(v_date,1,6) v_year_month,v_qty from tablename
where v_date between '201103' and '201210')
goroup by v_year_month