当前位置: 移动技术网 > IT编程>开发语言>PHP > PHP文章按日期(月日)SQL归档语句

PHP文章按日期(月日)SQL归档语句

2019年04月14日  | 移动技术网IT编程  | 我要评论
复制代码 代码如下:

select from_unixtime(pubtime, '%y-%m') as pubtime, count(*) as cnt from articles group by from_unixtime(pubtime, '%y-%m')

php文章按日期(日)sql归档
复制代码 代码如下:

select from_unixtime(pubtime, '%y-%m-%d') as pubtime, count(*) as cnt from articles group by from_unixtime(pubtime, '%y-%m-%d')

非时间戳日期格式归档(date_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 月 %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

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网