select sum(金额) from table group by time having month(time)=month(searchtime)
查年
select sum(金额) from table group by time having year(time)=year(searchtime)
月统计与年统计??
select sum(金额) from table where time between begintime and endtime;
或者
select sum(金额) from table where time>=begintime and time<=endtime
表示时间范围!
下面查月
select sum(金额) from table where group by time having month(time)=month(searchtime)
查年
select sum(金额) from table where group by time having year(time)=year(searchtime)