Skip site navigation (1) Skip section navigation (2)

Re: Formulating an sql query with CTID

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Tzahi Fadida <Tzahi(dot)ML(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Formulating an sql query with CTID
Date: 2006-07-29 16:25:39
Message-ID: (view raw or whole thread)
Lists: pgsql-hackers
On Sat, Jul 29, 2006 at 03:37:15AM +0300, Tzahi Fadida wrote:
> Hi,
> I have a query i am having trouble to formulate:
> I used to do:
> SELECT DISTINCT a0,a1 FROM public.t1
> However, now i need to add the CTID attribute, but CTID is unique
> thus, distinct is useless. In addition, i can't seem to be able to use max()
> etc... or casting to anything on CTID in order to use group by technique.

Use DISTINCT ON, see the docs for details.

That's for an older version, but it still works the same, google isn't
delivering the newer version...

Have an nice day,
Martijn van Oosterhout   <kleptog(at)svana(dot)org>
> From each according to his ability. To each according to his ability to litigate.

In response to


pgsql-hackers by date

Next:From: Luke LonerganDate: 2006-07-29 16:43:21
Subject: Re: On-disk bitmap index patch
Previous:From: Tzahi FadidaDate: 2006-07-29 15:58:57
Subject: Re: pgindet ^M

Privacy Policy | About PostgreSQL
Copyright © 1996-2015 The PostgreSQL Global Development Group