--- Mark Tessier <m_tessier(at)sympatico(dot)ca> wrote:
> My question is hopefully a simple one: If I have
> several rows, each containing a date field, and I
> want to select the row that has the date closest to
> today's date, what would be the syntax for carrying
> that out.
select * from tablename order by abs(current_date -
datefield) desc limit 1;
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
In response to
pgsql-general by date
|Next:||From: Sergio Pili||Date: 2003-04-28 19:07:32|
|Subject: Error: No one parent tuple was found|
|Previous:||From: Jay O'Connor||Date: 2003-04-28 18:59:29|
|Subject: Re: Selecting the most recent date|