Re: novice question about NOTICE:...

From: Lloyd Vancil <lev(at)apple(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: novice question about NOTICE:...
Date: 2002-04-03 22:26:09
Message-ID: a05101035b8d12999c9e3@[17.207.13.64]
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Thanks Doug.
But then it came up with
ERROR: Column reference "oid" is ambiguous.
and eventually
ERROR: Column reference "lang" is ambiguous
because -every- table has an OID and in this case both tables have
a column 'lang'

so, correctly it is
select cgidat.oid, cgidat.lang from cgidat, tierdat where
cgidat.state = 'testing' and
cgidat.lang = tiredat.lang and
tierdat.tier = '0' order by lang;
And if you dont select lang then the order by has to be qualified too.

select cgidat.oid from cgidat, tierdat where
cgidat.state = 'testing' and
cgidat.lang = tiredat.lang and
tierdat.tier = '0' order by cgidat.lang;

At 12:55 PM -0800 4/3/02, Doug Silver wrote:
>
>That was mighty nice of Postgres to fix your query -- I didn't know it
>would do that. You're doing a join from two tables, cgidat and tierdat,
>so you must include them in your FROM clause:
>
>select oid, lang from cgidat, tierdat where
>cgidat.state = 'testing' and
>cgidat.lang = tiredat.lang and
>tierdat.tier = '0' order by lang;
>
>or using aliases (a must when you start joining several tables):
>
>select c.oid,c.lang from cgidat c, tierdat t where
>c.state='testing' and
>c.lang = t.lang and
>t.tier ='0' order by c.lang

--
searchmaster(at)apple(dot)com
lev(at)apple(dot)com

Browse pgsql-novice by date

  From Date Subject
Next Message Morrison, Trevor (Trevor) 2002-04-03 22:27:37 FW: readline and psql
Previous Message Doug Silver 2002-04-03 20:55:16 Re: novice question about NOTICE:...