Re: a bit confused about distinct() function

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Tena Sakai" <tsakai(at)gallo(dot)ucsf(dot)edu>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: a bit confused about distinct() function
Date: 2009-03-29 17:49:07
Message-ID: 24286.1238348947@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

"Tena Sakai" <tsakai(at)gallo(dot)ucsf(dot)edu> writes:
> I am a bit confused about distinct() function.

Your confusion is in thinking that DISTINCT is a function. It is not;
it's just a keyword that modifies SELECT. Write

select distinct subjectid, markerid, allele1id, allele2id
from tsakai.mygenotype2
...

The other syntax was being read as an implicit row constructor, like

select distinct row(subjectid, markerid, allele1id, allele2id)

which actually will work in PG 8.4, but does not in existing releases;
and you likely wouldn't like the output format anyway, since it would
just be one composite column.

regards, tom lane

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tena Sakai 2009-03-29 18:02:33 Re: a bit confused about distinct() function
Previous Message Osvaldo Kussama 2009-03-29 17:44:28 Re: a bit confused about distinct() function