Re: Ambiguous columns

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Steve Tucknott <steve(at)retsol(dot)co(dot)uk>
Cc: PostGreSQL <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Ambiguous columns
Date: 2005-07-04 06:12:45
Message-ID: 20050704061245.GA26547@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Sun, Jul 03, 2005 at 08:17:01 +0100,
Steve Tucknott <steve(at)retsol(dot)co(dot)uk> wrote:
> If I have two tables(taba, tabb) with the same column (column1) name and
> try to do:
>
> SELECT taba.column1 AS column1,tabb.column2 AS column2
> FROM taba AS a
> JOIN tabb AS b
> ON taba.indexCol = tabb.indexCol
> GROUP BY column1
>
> It tells me that column1 is ambiguous. Is that to be expected? I can
> semi see why - but I thought you could only only group on selected
> fields, and the only 'selected' column1 is that from taba. Minor issue,
> with easy work around.

You have things backwards. You can only select fields that are used in
the group by list or that are aggregates. You can have things used
for grouping that are not output in the select list.

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Steve Tucknott 2005-07-04 06:20:11 Re: Ambiguous columns
Previous Message Tom Lane 2005-07-03 16:07:21 Re: Ambiguous columns