Re: Selecting the most recent date - Mailing list pgsql-general

From Jeff Eckermann
Subject Re: Selecting the most recent date
Date
Msg-id 20030428190700.50580.qmail@web20809.mail.yahoo.com
Whole thread Raw
In response to Selecting the most recent date  (Mark Tessier <m_tessier@sympatico.ca>)
List pgsql-general
--- Mark Tessier <m_tessier@sympatico.ca> wrote:
> Hi,
>
> 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.
http://search.yahoo.com


pgsql-general by date:

Previous
From: Sergio Pili
Date:
Subject: Error: No one parent tuple was found
Next
From: "Jimmie H. Apsey"
Date:
Subject: Re: Postgres client/server parameters?