SQL statement for archiving PHP articles by date (month/day)
- 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
- Select FROM_UNIXTIME (pubtime, '% Y-% m-% d') as pubtime, count (*) as cnt from articles group by FROM_UNIXTIME (pubtime, '% Y-% m-% d ')
Archive non-timestamp date format (date_format format)
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 'post _ status' = 'Publish 'group by date_format ('post _ date', '% Y % m % d ') order by 'id' desc limit 0, 7
|