教程集 www.jiaochengji.com
教程集 >  脚本编程  >  php  >  正文 PHP文章按日期(月日)归档的sql语句

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

发布时间:2015-01-24   编辑:jiaochengji.com
PHP文章按日期(月日)SQL归档PHP文章按日期(月)归档的sql语句,有需要的朋友可以参考学习之。
复制代码 代码如下:
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

您可能感兴趣的文章:
PHP文章按日期(月日)归档的sql语句
jQuery双日历插件 jQuery Datepicker
有关Oracle的时间/日期的操作
mysql查询指定日期时间内的sql语句及原理
mysql获取当前系统时间及当前日期方便查询判定
收集的一些oracle sql语句
Php按时间查询 Mysql常用语句
关于mysql日期的一些例子
php日期所在月的第一天日期和最后一天
php查询指定日期范围内数据

[关闭]
~ ~