您好,欢迎访问一九零五行业门户网

求教一个数据库有关问题,有张表,里面有每天存入的数据,如何取出每个月数据的条数

求教一个数据库问题,有张表,里面有每天存入的数据,怎么取出每个月数据的条数。
这是ec_ip_article表,iptime是每天的时间戳。有没有简便一点的方法,不想每个月一条条sql取出来,然后再count得出数目,那样sql太多了。
------解决思路----------------------
select from_unixtime(iptime,'%y-%m') as m, count(*) as cnt from ec_ip_article group by 1
------解决思路----------------------
select from_unixtime(iptime,'%y%m%d'),count(0) from ec_ip_article group by from_unixtime(iptime,'%y%m%d')


------解决思路----------------------
引用:
select from_unixtime(iptime,'%y%m%d'),count(0) from ec_ip_article group by from_unixtime(iptime,'%y%m%d')


select from_unixtime(iptime,'%y%m'),count(0) from ec_ip_article group by from_unixtime(iptime,'%y%m')
------解决思路----------------------
select ip_id,count(ip_id) count,from_unixtime(iptime, '%y%m%d') date from test group by from_unixtime(iptime, '%c') order by iptime

其它类似信息

推荐信息