Copy Code code as follows:
Select From_unixtime (pubtime, '%y-%m ') as Pubtime, COUNT (*) as CNT from articles Group by from_unixtime (Pubtime, '%y-%m ')
PHP articles are archived by Date (day) SQL
Copy Code code as follows:
Select From_unixtime (pubtime, '%y-%m-%d ') as Pubtime, COUNT (*) as CNT from articles Group by from_unixtime (Pubtime, '%y-%m -%d ')
Non-timestamp date format archive (date_format format date)
Copy Code code as follows:
Select Date_format (' post_date ', '%y%m%d ') as Pubtime, COUNT (*) as CNT from WP_ Posts where ' post_status ' = ' publish ' GROUP by Date_format (' post_date ', '%y%m%d ') Order by ' ID ' desc
Select Date_format (' Post_date ', '%y%m%d ') as Pubtime,date_format (' post_date ', '%m month%d ') as Shijian,count (*) as CNT from wp_posts where ' pos T_status ' = ' publish ' GROUP by Date_format (' post_date ', '%y%m%d ') Order by ' ID ' desc limit 0,7