MySQL写一条sql语句查询一年中每个月的所有数据数量。时间字段是uptime 是decimal类型的
select month ( updatetime ),count(*) from 表 where year ( updatetime) = 2015 group by mouth ( updatetime );
select monthname(uptime),count(*) from table where year(uptime)=2015 group monthname(uptime).
如果满足要求请点击下采纳 谢谢 这里的uptime要对应你实际的日期命名
select month ( updatetime ),count(*) from 表 where year ( updatetime) = 2015 group by mouth ( updatetime );
时间类型是decimal类型的
select 月份,count(*) from 表 where year=2015 group by month;
之后你就像怎么获取month就行了,不过不懂你的decimal类型的数据,不是有专门的时间类型嘛
select monthname(uptime),count(*) from table where year(uptime)=2015 group monthname(uptime).
这个语句是没有问题的,有问题的可能在你的表名、字段名、数据类型上