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

Re: Formulating an sql query with CTID

From: Tzahi Fadida <Tzahi(dot)ML(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Formulating an sql query with CTID
Date: 2006-07-29 10:37:44
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
Found my answer thanks to Ragnar.
SELECT DISTINCT ON (a0,a1) a0,a1,ctid FROM t1 

To tell the truth, i did not know there was an ON option in SQL.
This thing is very handy.

On Saturday 29 July 2006 03:37, 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.
> What are my options?
> (I am using 8.2 or 8.1)

Tzahi Fadida
Blog: | Home Site:

In response to


pgsql-hackers by date

Next:From: korryd@enterprisedb.comDate: 2006-07-29 12:18:33
Subject: Re: [HACKERS] Possible explanation for Win32 stats regression test
Previous:From: Joe ConwayDate: 2006-07-29 06:50:05
Subject: Re: [HACKERS] 8.2 features?

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