ホームページ  >  記事  >  バックエンド開発  >  日付 (月日) による PHP 記事 SQL アーカイブ ステートメント_PHP チュートリアル

日付 (月日) による PHP 記事 SQL アーカイブ ステートメント_PHP チュートリアル

WBOY
WBOYオリジナル
2016-07-21 15:14:21726ブラウズ

コードをコピー コードは次のとおりです:

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 ') `ID` の記述で並べ替えます
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' date_format(`post_date`,'%Y%m%d') によるグループ化 `ID` による順序 記述制限 0,7

www.bkjia.comtru​​ehttp://www.bkjia.com/PHPjc/326264.html技術記事次のようにコードをコピーします。 select FROM_UNIXTIME(pubtime, '%Y-%m') as pubtime、count(*) as cnt from items group by FROM_UNIXTIME(pubtime, '%Y-%m') PHP 記事 by date (日) ) SQL の戻り値...
声明:
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。