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

yipeiwu_com6年前PHP代码库
复制代码 代码如下:

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查询及多条件查询

php查询及多条件查询

单条件查询: 1.先要有一张表,显示出表中的数据: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"...

php通过前序遍历树实现无需递归的无限极分类

本文实例讲述了php通过前序遍历树实现无需递归的无限极分类。分享给大家供大家参考。具体如下: 大家通常都是使用递归实现无限极分类都知道递归效率很低,下面介绍一种改进的前序遍历树算法,不适...

在yii中新增一个用户验证的方法详解

1.为什么要新增一个用户验证:因为我要将网站后台和前台做在同一个yii的应用中.但是前台也包含有会员的管理中心.而这两个用户验证是完全不同的,所以需要两个不同登陆页面,要将用户信息保存在...

php feof用来识别文件末尾字符的方法

EOF 是非常重要的概念,几乎每种主流编程语言都提供了相应的内置函数,来验证解析器是否到达了文件EOF。在PHP 中,此函数是feof ()。feof ()函数用来确定是否到达资源末尾。...

分享一则PHP定义函数代码

先贴代码 复制代码 代码如下: <?php     function table(){     &nb...