<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

        MySQL Select: WHERE (time now) = BETWEEN tablevalue AND tablevalue(MySQL 选择:WHERE(现在时间)= BETWEEN tablevalue AND tablevalue)
        <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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  Set the variable result, from query(设置变量结果,来自查询)
                  What is dynamic SQL?(什么是动态 SQL?)
                  Mysql - How to quit/exit from stored procedure(Mysql - 如何退出/退出存储过程)
                  Does MySQL have time-based triggers?(MySQL 有基于时间的触发器吗?)
                  is it possible to call a sql script from a stored procedure in another sql script?(是否可以从另一个 sql 脚本中的存储过程调用 sql 脚本?)
                  Procedure to loop through comma separated string is not working(遍历逗号分隔字符串的过程不起作用)

                  <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>

                    <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>
                            <tbody id='egn6A'></tbody>