1.通过sql语句分组查询后要对查出的列设置列名,否则无列名,只能查出第一列的数据;
2.既要统计年,又要统计月,那就要对年和月分别
group by
select year([StartTime])
AS YEAR
, month([StartTime])
AS MONTH
,sum(Volumn)
AS SUM
,sum(Money)
AS MONEY
from ConsumeLog where ICID='ICCard' and year([StartTime])='startTime'
group by month([StartTime]),year([StartTime])
order by month desc