List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:July 3 1999 11:38pm
Subject:Re: query question with timestamps
View as plain text  
>> Select the timestamp and the difference between the timestamp and
>> the given value, sort on the difference, and apply LIMIT 1?
>
>What ???
>
>Can you please create a sample query ?
>
>Thanx
>
>Norbert

DROP TABLE IF EXISTS ts;
CREATE TABLE ts (t TIMESTAMP);
INSERT ts VALUES("1999-01-01"),("1999-02-01"),
("1999-03-01"), ("1999-04-01"), ("1999-05-01"), ("1999-06-01");
SELECT t,ABS(TO_DAYS(t)-TO_DAYS("1999-03-01")) AS diff
FROM ts ORDER BY diff LIMIT 1;

--
Paul DuBois, paul@stripped
Northern League Chronicles: http://www.snake.net/nl/
Thread
root denied access on installScott Seller4 Jul
  • Re: root denied access on installDarrell Shifflett4 Jul
    • query question with timestampsNorbert Kolb4 Jul
      • Re: query question with timestampsPaul DuBois4 Jul
Re: query question with timestampsPaul DuBois4 Jul