Many thanks, Tom.

Regards,

Tena Sakai
tsa...@gallo.ucsf.edu


-----Original Message-----
From: Tom Lane [mailto:t...@sss.pgh.pa.us]
Sent: Sun 3/29/2009 10:49 AM
To: Tena Sakai
Cc: pgsql-sql@postgresql.org
Subject: Re: [SQL] a bit confused about distinct() function 
 
"Tena Sakai" <tsa...@gallo.ucsf.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

Reply via email to