> 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. -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general