Re: Interval ordering - Mailing list pgsql-general

From Adam Rich
Subject Re: Interval ordering
Date
Msg-id 006901ccded6$d379e350$7a6da9f0$@sbcglobal.net
Whole thread Raw
In response to Re: Interval ordering  (Adrian Klaver <adrian.klaver@gmail.com>)
Responses Re: Interval ordering
List pgsql-general
> How about something like:
> test(5432)aklaver=>SELECT ts_fld2,now()-ts_fld2 from timestamp_test order
by
>  now()-ts_fld2 limit 5;

Thanks Adrian,
Let me explain the problem better.  Say my table has 24 entries, one for
each
hour, midnight through 11 pm.  If the user enters "6:30 PM", I want to give
them
the closest times in proximity - both before AND after - to their input...
so in this
case, I'd return 5:00 PM, 6:00 PM, 7:00 PM, 8:00 PM, etc.

I believe your solution only provides the closest times BEFORE and not
AFTER.




pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Interval ordering
Next
From: Adrian Klaver
Date:
Subject: Re: Interval ordering