Re: Ambiguous columns - Mailing list pgsql-novice

From Steve Tucknott
Subject Re: Ambiguous columns
Date
Msg-id 1120458011.2776.13.camel@retsol1
Whole thread Raw
In response to Re: Ambiguous columns  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-novice
Tom,
That could have been the case. The original query had both GROUP and
ORDER. I assumed (my mistake) that the error was being generated by the
GROUP clause. Why should ORDER by object - isn't that the same - ie it
can only order on the selected fields?


On Sun, 2005-07-03 at 17:07, Tom Lane wrote:
> 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
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
>        choose an index scan if your joining column's datatypes do not
>        match
--


Regards,

Steve Tucknott
ReTSol Ltd

DDI    01903 828769
MOBILE    07736715772



___________________________________________________________
How much free photo storage do you get? Store your holiday
snaps for FREE with Yahoo! Photos http://uk.photos.yahoo.com

pgsql-novice by date:

Previous
From: Bruno Wolff III
Date:
Subject: Re: Ambiguous columns
Next
From: Peter Billen
Date:
Subject: Re: Starting postgres 8.0.3