Re: [GENERAL] max() question

Поиск
Список
Период
Сортировка
От Aaron J. Seigo
Тема Re: [GENERAL] max() question
Дата
Msg-id 99091412253102.03076@stilborne
обсуждение исходный текст
Ответ на max() question  (Hitesh Patel <hitesh@presys.com>)
Ответы Re: [GENERAL] max() question  (Michael Simms <grim@argh.demon.co.uk>)
Список pgsql-general
On Tue, 14 Sep 1999, you wrote:
> I have a table with and email address and a datetime timestamp.  What
> would be the easiest way to select the 3 earliest timestamps (earliest
> being furthest in the past from the current date)

lots of ways =) though the first that comes to mind is the use of cursors.
order by DATEFIELD asc and just grab the first three.. or if that don't work for
ya (for whatever reason)... you could select the min(DATEFIELD), then select the
min(DATEFIELD) where DATEFIELD > (that last select's return), then again for
the third... this is convoluted, but if you are doing this over a network, a
cursor may not be the easiest thing to implement, depending on what you are
using. as for performance of this? i dunno. cursor would be best.

--
Aaron J. Seigo
Sys Admin

В списке pgsql-general по дате отправления:

Предыдущее
От: "Stéphane FILLON"
Дата:
Сообщение: Permission problem with COPY FROM
Следующее
От: Michael Simms
Дата:
Сообщение: Re: [GENERAL] max() question