List:General Discussion« Previous MessageNext Message »
From:Thimble Smith Date:August 19 1999 6:38pm
Subject:Re: SELECT by timestamp...
View as plain text  
At 10:55, 19990819, "Martin Lilienthal"<webmaster@stripped> wrote:
>Is there a way to select all rows which are inserted 1 or more hours ago? 
>
>A table called test has these cols:
>
>col1 varchar(20),
>col2 int,
>col3 TIMESTAMP

    mysql> select * from test;
    +------+------+----------------+
    | col1 | col2 | col3           |
    +------+------+----------------+
    | a    |    1 | 19990819113000 |
    | b    |    2 | 19990819103000 |
    | c    |    3 | 19990819104000 |
    +------+------+----------------+
    3 rows in set (0.00 sec)

    mysql> select NOW(), test.* from test
        -> where col3 < date_sub(now(), interval 1 hour);
    +---------------------+------+------+----------------+
    | NOW()               | col1 | col2 | col3           |
    +---------------------+------+------+----------------+
    | 1999-08-19 11:35:59 | b    |    2 | 19990819103000 |
    +---------------------+------+------+----------------+
    1 row in set (0.00 sec)

Tim
Thread
SELECT by timestamp...Geocrawler.com19 Aug
  • Re: SELECT by timestamp...Thimble Smith19 Aug
RE: SELECT by timestamp...Darren L Sweeney19 Aug