Can anyone help me to understand how MySQL can not read queues, I try to execute this query Is of
select from appearance where '2010-07-13 00:06:00' time and time expired; This table contains the date:
+ -------------------- - - + ----------------------- + | Timin | Timeout | ------------------------ + ------------------------ | 2010-07-13 23:44:11 | 2010-07-14 08:01:14 | | 2010-07-12 23:40:56 | 2010-07-13 08:00:52 | | 2010-07-10 05:49:32 | 2010-07-10 14:00:45 | + ----------------------- + ----------------------- + < / Code> As we can see on the table, line 2 date is expected to complete verification, but when I execute the query, it does not produce any results. If someone asks an alternative question then nobody can help.
Your query is ok, it should work as expected:
Make Table Appearance (id int, timeline data, timeout datetime); Insert attendance values (1, '2010-07-13 23:44:11', '2010-07-14 08:01:14'); Insert attendance values (2, '2010-07-12 23:40:56', '2010-07-13 08:00:52'); Insert attendance values (3, '2010-07-10 05:49:32', '2010-07-10 14:00:45'); Choose from attendance where '2010-07-13 00:06:00' time and time expired; + ------ + --------------------- + -------------------- - + | ID | Timin | Timeout | + ------ + --------------------- + -------------------- - + | 2 | 2010-07-12 23:40:56 | 2010-07-13 08:00:52 | + ------ + --------------------- + -------------------- - Line (0.01 seconds) in 1 set Are you sure your the timeline and timeout are of the field type Date time or timestamp ?
varchar : Make Table Appearance (id int, timen varchar (100), timeout varchar (100)); Insert attendance values (1, '2010-07-13 23:44:11', '2010-07-14 08:01:14'); Insert attendance values (2, '2010-07-12 23:40:56', '2010-07-13 08:00:52'); Insert attendance values (3, '2010-07-10 05:49:32', '2010-07-10 14:00:45'); Choose from attendance where '2010-07-13 00:06:00' time and time expired; + ------ + --------------------- + -------------------- - + | ID | Timin | Timeout | + ------ + --------------------- + -------------------- - + | 2 | 2010-07-12 23:40:56 | 2010-07-13 08:00:52 | + ------ + --------------------- + -------------------- - + 1 line set (0.00 seconds) However your field should not be varchar , as it would be to compare the strings instead of a time above .
Comments
Post a Comment