Re: restricting similar rows

Поиск
Список
Период
Сортировка
От Ciprian Popovici
Тема Re: restricting similar rows
Дата
Msg-id 15412280174.20020919133946@integrare.ro
обсуждение исходный текст
Ответ на restricting similar rows  (Ciprian Popovici <ciprian.popovici@integrare.ro>)
Список pgsql-novice
Thursday, September 19, 2002, 12:01:46 PM, Ciprian Popovici <ciprian.popovici@integrare.ro> wrote:
> need all of them. Plus I don't know how to properly translate this
> query into Postgres.

Figured it out, eventually. Here's the Postgres query:

select distinct on (code) \
  id,code,active from objects \
  where version<=1 and (process=17 or process=0) \
  group by id,code,active,version \
  order by code asc,active desc,version desc

I supply version and process values and I get whatever I need back
(id,code,active). Kudos to Postgres for the 'distinct on' clause.

-- Ciprian Popovici <ciprian.popovici@integrare.ro>


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

Предыдущее
От: Joel Rodrigues
Дата:
Сообщение: Re: 7.2.2 java configure problem on Mac OS X 10.1.5
Следующее
От: Rory Campbell-Lange
Дата:
Сообщение: Make an id field max(id)+1 rather than SERIAL