Rumah  >  Artikel  >  pembangunan bahagian belakang  >  PHP文章按日期(月日)SQL归档语句_PHP教程

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

WBOY
WBOYasal
2016-07-21 15:14:21726semak imbas

复制代码 代码如下:

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

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/326264.htmlTechArticle复制代码 代码如下: select FROM_UNIXTIME(pubtime, '%Y-%m') as pubtime, count(*) as cnt from articles group by FROM_UNIXTIME(pubtime, '%Y-%m') PHP文章按日期(日)SQL归...
Kenyataan:
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn