Ask for a database problem, there is a table, there are daily data deposited, how to take out the number of data per month.
This is the Ec_ip_article table, Iptime is the time stamp of the day. There is no easy way to do, do not want to every month of SQL out, and then count the number, that SQL too much.
------to solve the idea----------------------
Select From_unixtime (iptime, '%y-%m ') as M, Count (*) as CNT from Ec_ip_article GROUP by 1
------to solve the idea----------------------
Select From_unixtime (iptime, '%y%m%d '), COUNT (0) from Ec_ip_article Group by From_unixtime (Iptime, '%y%m%d ')
------to solve the idea----------------------
References:
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 ')
------to solve the idea----------------------
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