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

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

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

        <tfoot id='clxtq'></tfoot>
      1. 如何选择具有当天时间戳的行?

        How to select rows that have current day#39;s timestamp?(如何选择具有当天时间戳的行?)

        <small id='0Mbpq'></small><noframes id='0Mbpq'>

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

              • <legend id='0Mbpq'><style id='0Mbpq'><dir id='0Mbpq'><q id='0Mbpq'></q></dir></style></legend>

                <tfoot id='0Mbpq'></tfoot>

                  本文介绍了如何选择具有当天时间戳的行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我试图只从数据库表中选择今天的记录.

                  I am trying to select only today's records from a database table.

                  目前我使用

                  SELECT * FROM `table` WHERE (`timestamp` > DATE_SUB(now(), INTERVAL 1 DAY));
                  

                  但这需要过去 24 小时的结果,我需要它只选择今天的结果,而忽略时间.如何仅根据日期选择结果?

                  But this takes results for the last 24 hours, and I need it to only select results from today, ignoring the time. How can I select results based on the date only ?

                  推荐答案

                  使用 DATECURDATE()

                  SELECT * FROM `table` WHERE DATE(`timestamp`) = CURDATE()
                  

                  警告!此查询没有有效地使用索引.有关更有效的解决方案,请参阅下面的答案

                  Warning! This query doesn't use an index efficiently. For the more efficient solution see the answer below

                  查看DEMO上的执行计划

                  这篇关于如何选择具有当天时间戳的行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  Can#39;t Create Entity Data Model - using MySql and EF6(无法创建实体数据模型 - 使用 MySql 和 EF6)
                  MySQL select with CONCAT condition(MySQL选择与CONCAT条件)
                  Capitalize first letter of each word, in existing table(将现有表格中每个单词的首字母大写)
                  How to retrieve SQL result column value using column name in Python?(如何在 Python 中使用列名检索 SQL 结果列值?)
                  Update row with data from another row in the same table(使用同一表中另一行的数据更新行)
                  Exporting results of a Mysql query to excel?(将 Mysql 查询的结果导出到 excel?)
                    <tbody id='O2nuA'></tbody>
                  • <bdo id='O2nuA'></bdo><ul id='O2nuA'></ul>

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

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

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