Re: Ambiguous columns

From: Steve Tucknott <steve(at)retsol(dot)co(dot)uk>
To: PostGreSQL <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Ambiguous columns
Date: 2005-07-04 06:20:11
Message-ID: 1120458011.2776.13.camel@retsol1
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)retsol(dot)co(dot)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

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Peter Billen 2005-07-04 06:51:13 Re: Starting postgres 8.0.3
Previous Message Bruno Wolff III 2005-07-04 06:12:45 Re: Ambiguous columns