Fwd: Re: Selecting the most recent date

Поиск
Список
Период
Сортировка
Искать
От
Jeff Eckermann
Тема
Fwd: Re: Selecting the most recent date
Дата
Msg-id
20030428214623.41946.qmail@web20802.mail.yahoo.com
Список
Дерево обсуждения
Fwd: Re: Selecting the most recent date Jeff Eckermann <jeff_eckermann@yahoo.com>
Re: Fwd: Re: Selecting the most recent date Dennis Gearon <gearond@cvc.net>
Re: Fwd: Re: Selecting the most recent date Jeff Eckermann <jeff_eckermann@yahoo.com>
--- Jeff Eckermann  wrote:
> Date: Mon, 28 Apr 2003 12:07:00 -0700 (PDT)
> From: Jeff Eckermann 
> Subject: Re: [GENERAL] Selecting the most recent
> date
> To: Mark Tessier ,
> 	pgsql-general@postgresql.org
> 
> --- Mark Tessier  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;
> 
Whoops, that "desc" should not be there: that would
get you the opposite result to the one you want ;-)
Sorry for the (my) confusion.

__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com

В списке pgsql-general по дате отправления
От: Antti Haapala
Дата:
Сообщение: Re: timestamps and dates
От: scott.marlowe
Дата:
FAQ