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

        • <bdo id='NHGba'></bdo><ul id='NHGba'></ul>

      1. <tfoot id='NHGba'></tfoot><legend id='NHGba'><style id='NHGba'><dir id='NHGba'><q id='NHGba'></q></dir></style></legend>

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

        MySQL 选择:WHERE(现在时间)= BETWEEN tablevalue AND tablevalue

        时间:2023-10-26
        <tfoot id='t3ghm'></tfoot>

        • <bdo id='t3ghm'></bdo><ul id='t3ghm'></ul>

          <legend id='t3ghm'><style id='t3ghm'><dir id='t3ghm'><q id='t3ghm'></q></dir></style></legend>
          1. <small id='t3ghm'></small><noframes id='t3ghm'>

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

                1. 本文介绍了MySQL 选择:WHERE(现在时间)= BETWEEN tablevalue AND tablevalue的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在寻找一种方法来选择当前时间在行中两个设定值之间的行.我已经建立了一个包含 3 列的表,其中 2 列包含时间戳 (HH:MM:SS),另一个是字符串.有没有办法获得与当前时间相对应的字符串?用更抽象的方式来说:

                  I'm looking for a way to select the row in which the current time is between two set values in the row. I've set up a table with 3 columns, 2 of them hold a timestamp (HH:MM:SS), the other one a string. Is there a way I can get the string corresponding to the current time? To put it in a more abstract way:

                  SELECT String FROM TableName WHERE (Current Time) BETWEEN (Lower Limit Time Value) AND (Upper Limit Time Value);

                  SELECT String FROM TableName WHERE (Current Time) BETWEEN (Lower Limit Time Value) AND (Upper Limit Time Value);

                  所以基本上,根据当前时间,我的脚本应该输出正确的字符串.

                  So basically, based on the current time, my script should output the correct string.

                  我该怎么做?谢谢!

                  推荐答案

                  MySQL 中,timestamp 是一个很容易混淆的词.

                  In MySQL, timestamp is quite a confusing word.

                  如果它们是 lowerlimitupperlimitTIME 列,从 00:00:0023:59:59:

                  If they are lowerlimit and upperlimit are TIME columns from 00:00:00 to 23:59:59:

                  SELECT  String
                  FROM    TableName
                  WHERE   CURTIME() BETWEEN lowerlimit AND upperlimit
                          OR CURTIME() BETWEEN SUBTIME(upperlimit, '24:00:00') AND lowerlimit
                          OR SUBTIME(CURTIME(), '24:00:00') BETWEEN SUBTIME(upperlimit, '24:00:00') AND lowerlimit
                  

                  这将正确处理午夜转换.

                  This will handle midnight transitions correctly.

                  这篇关于MySQL 选择:WHERE(现在时间)= BETWEEN tablevalue AND tablevalue的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:mysql 系统变量 table_type 不起作用 下一篇:选择计数(*);

                  相关文章

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

                2. <legend id='egn6A'><style id='egn6A'><dir id='egn6A'><q id='egn6A'></q></dir></style></legend>

                    <tfoot id='egn6A'></tfoot>

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