<bdo id='SvFNn'></bdo><ul id='SvFNn'></ul>
    1. <small id='SvFNn'></small><noframes id='SvFNn'>

      <tfoot id='SvFNn'></tfoot>
      <i id='SvFNn'><tr id='SvFNn'><dt id='SvFNn'><q id='SvFNn'><span id='SvFNn'><b id='SvFNn'><form id='SvFNn'><ins id='SvFNn'></ins><ul id='SvFNn'></ul><sub id='SvFNn'></sub></form><legend id='SvFNn'></legend><bdo id='SvFNn'><pre id='SvFNn'><center id='SvFNn'></center></pre></bdo></b><th id='SvFNn'></th></span></q></dt></tr></i><div id='SvFNn'><tfoot id='SvFNn'></tfoot><dl id='SvFNn'><fieldset id='SvFNn'></fieldset></dl></div>

        <legend id='SvFNn'><style id='SvFNn'><dir id='SvFNn'><q id='SvFNn'></q></dir></style></legend>
      1. MySQL 按日期分组并从 unix 时间戳转换

        MySQL group by date and convert from unix timestamp(MySQL 按日期分组并从 unix 时间戳转换)
            <bdo id='RmoMC'></bdo><ul id='RmoMC'></ul>

              <small id='RmoMC'></small><noframes id='RmoMC'>

              <i id='RmoMC'><tr id='RmoMC'><dt id='RmoMC'><q id='RmoMC'><span id='RmoMC'><b id='RmoMC'><form id='RmoMC'><ins id='RmoMC'></ins><ul id='RmoMC'></ul><sub id='RmoMC'></sub></form><legend id='RmoMC'></legend><bdo id='RmoMC'><pre id='RmoMC'><center id='RmoMC'></center></pre></bdo></b><th id='RmoMC'></th></span></q></dt></tr></i><div id='RmoMC'><tfoot id='RmoMC'></tfoot><dl id='RmoMC'><fieldset id='RmoMC'></fieldset></dl></div>

                  <tbody id='RmoMC'></tbody>

                <legend id='RmoMC'><style id='RmoMC'><dir id='RmoMC'><q id='RmoMC'></q></dir></style></legend>

                  <tfoot id='RmoMC'></tfoot>

                • 本文介绍了MySQL 按日期分组并从 unix 时间戳转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有如下sql表(简体)

                  I have the following sql table (simplified)

                  ID (int)  title (text)            date (int)
                  --------------------------------------------
                  1         Hello World             1378148920
                  2         Hello World2            1378182183
                  3         Hello World3            1378129838
                  4         Hello World4            1378146160
                  5         Hello World5            1378138038
                  ....
                  

                  该表有数千个条目.

                  我不想问你是否可以构建一个 SQL 查询,将所有帖子按日期分组,但仅按天分组.

                  I wan't to ask you if it is possible to build a SQL query that groups all the posts by date but only as day.

                  所以最后我不想构建这样的图表(过去 5 天):

                  So at the end I wan't to build a graph like this (for the last 5 days):

                  02.09.2013: 13 posts
                  01.09.2013: 14 posts
                  

                  注意:时间戳不是真实的(它们都是从今天开始的)

                  NOTE: the timestamp aren't real (they are all from today)

                  推荐答案

                  你可以使用from-unixtime()

                  select FROM_UNIXTIME(`date`, '%d.%m.%Y') as ndate,
                         count(id) as post_count
                  from your_table
                  group by ndate
                  

                  这篇关于MySQL 按日期分组并从 unix 时间戳转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Converting string to MySQL timestamp format in php(在php中将字符串转换为MySQL时间戳格式)
                  datetime to timestamp(日期时间到时间戳)
                  PHP timestamp date to user timezone(PHP时间戳日期到用户时区)
                  Converting TIMESTAMP to unix time in PHP?(在 PHP 中将 TIMESTAMP 转换为 unix 时间?)
                  Convert ISO 8601 to unixtimestamp(将 ISO 8601 转换为 unixtimestamp)
                  Finding days between 2 unix timestamps in php(在php中查找2个unix时间戳之间的天数)

                  <i id='IG1eB'><tr id='IG1eB'><dt id='IG1eB'><q id='IG1eB'><span id='IG1eB'><b id='IG1eB'><form id='IG1eB'><ins id='IG1eB'></ins><ul id='IG1eB'></ul><sub id='IG1eB'></sub></form><legend id='IG1eB'></legend><bdo id='IG1eB'><pre id='IG1eB'><center id='IG1eB'></center></pre></bdo></b><th id='IG1eB'></th></span></q></dt></tr></i><div id='IG1eB'><tfoot id='IG1eB'></tfoot><dl id='IG1eB'><fieldset id='IG1eB'></fieldset></dl></div>
                      <tbody id='IG1eB'></tbody>
                    1. <legend id='IG1eB'><style id='IG1eB'><dir id='IG1eB'><q id='IG1eB'></q></dir></style></legend>
                      <tfoot id='IG1eB'></tfoot>
                        <bdo id='IG1eB'></bdo><ul id='IG1eB'></ul>

                        • <small id='IG1eB'></small><noframes id='IG1eB'>