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