Re: Ambiguous columns - Mailing list pgsql-novice

From Tom Lane
Subject Re: Ambiguous columns
Date
Msg-id 4673.1120406841@sss.pgh.pa.us
Whole thread Raw
In response to Ambiguous columns  (Steve Tucknott <steve@retsol.co.uk>)
Responses Re: Ambiguous columns
List pgsql-novice
Steve Tucknott <steve@retsol.co.uk> writes:
> 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?

Yes.

> I thought you could only only group on selected fields,

No, that's never been true.  You're confusing it with ORDER BY,
which has different rules.

            regards, tom lane

pgsql-novice by date:

Previous
From: Andreas Kretschmer
Date:
Subject: Re: [despammed] Ambiguous columns
Next
From: Bruno Wolff III
Date:
Subject: Re: Ambiguous columns