Re: Finding uniques across a big join

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: "John D(dot) Burger" <john(at)mitre(dot)org>
Cc: PostgreSQL general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Finding uniques across a big join
Date: 2005-12-01 05:31:19
Message-ID: 20051201053119.GA19705@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Nov 30, 2005 at 20:44:30 -0500,
"John D. Burger" <john(at)mitre(dot)org> wrote:
>
> That changes the semantics of what I want. If I group by personID
> above, then every FOUR-way combo is of course unique. What I'd like to
> do is group by the three attributes, and select for personID as well.
> But of course you can't select for columns you haven't grouped by.

Assuming that personID is an ordered type, you can select max(personID)
in the GROUP BY and save the join at the end.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Thomas F. O'Connell 2005-12-01 05:55:03 Re: SELECT Generating Row Exclusive Locks?
Previous Message Tom Lane 2005-12-01 05:24:39 Re: SELECT Generating Row Exclusive Locks?