Re: problem selecting multiple records (again!)

Поиск
Список
Период
Сортировка
От Manuel Sugawara
Тема Re: problem selecting multiple records (again!)
Дата
Msg-id m3ae3m30gu.fsf@dep1.fciencias.unam.mx
обсуждение исходный текст
Ответ на problem selecting multiple records (again!)  ("Giorgio Andreoletti - mentelocale" <giorgio.andreoletti@mentelocale.it>)
Список pgsql-novice
Nabil Sayegh <nsmail@sayegh.de> writes:

> On 05 Jun 2001 17:01:14 -0500, Manuel Sugawara wrote:
> >
> > something like
> >
> > select * from events where ref in (select distinct ref from events limit 3);
> >
> > will do what you want.
>
> Not exactly, he wanted the NEXT 3 events.

OK, I see; is not that simple eh?, but here is another idea, create a
view, something like:

create view events_v as select distinct on (ref) * from events where date >= now();

and then select limited to 3

select * from events_v order by date limit 3;

This may not do exactly what he wants but is closest solution i can
imagine ;-)

regards,
Manuel.

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

Предыдущее
От: Nabil Sayegh
Дата:
Сообщение: Re: problem selecting multiple records (again!)
Следующее
От: "Giorgio A."
Дата:
Сообщение: Re: problem selecting multiple records (again!)