日期:2014-05-16 浏览次数:20725 次
select name,sum(num),format(date,'%Y-%m') from table1 where date between '2012-02-01' and '2012-02-29' group by name having sum(num)>=2
------解决方案--------------------
select name,sum(num),'2012-02'
from table1
where date >'2012-02-01' and date<'2012-03-01'
group by name
having sum(num)>=2