<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上的执行计划

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

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

                  相关文档推荐

                  ibtmp1是非压缩的innodb临时表的独立表空间,通过innodb_temp_data_file_path参数指定文件的路径,文件名和大小,默认配置为ibtmp1:12M:autoextend,也就是说在文件系统磁盘足够的情况下,这个文件大小是可以无限增长的。 为了避免ibtmp1文件无止境的暴涨导致
                  SQL query to group by day(按天分组的 SQL 查询)
                  What does SQL clause quot;GROUP BY 1quot; mean?(SQL 子句“GROUP BY 1是什么意思?意思是?)
                  MySQL groupwise MAX() returns unexpected results(MySQL groupwise MAX() 返回意外结果)
                  MySQL SELECT most frequent by group(MySQL SELECT 按组最频繁)
                  Include missing months in Group By query(在 Group By 查询中包含缺失的月份)
                    <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>