Re: Select problem

From: Chris Ryan <chris(at)greatbridge(dot)com>
To: "Karl F(dot) Larsen" <k5di(at)zianet(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Select problem
Date: 2000-08-14 15:35:52
Message-ID: 399811D8.3A5EA78A@greatbridge.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

since armycall is a field in both tables postgres doesn't know which one
you are talking about. So in instances like these you have to fully
qualify the field name. i.e. data.armycall or biglist.armycall. Your
choice as in this instance the data will be the same. So the final query
should look like

select user, data.armycall
from data, biglist
where user.armycall = biglist armycall

As a general rule when i join tables I ussually qualify all the fields
in the query to make it clear as that what fields i trully want.

hope this helps

Chris Ryan
chris(at)greatbridge(dot)com

"Karl F. Larsen" wrote:
>
> I have a simple 3 table database with armycall as the common key
> and it all works fine when I doa select like so:
>
> select user, doer
> from data, biglist
> where user.armycall = biglist.armycall;
>
> but if I want to get the column armycall and use:
>
> select user, armycall
> from data, biglist
> where user.armycall = biglist.armycall
>
> I get an error that armycall is ambiguous.
>
> Does anyone know how to correct this?
>
> Yours Truly,
>
> - Karl F. Larsen, k5di(at)arrl(dot)net (505) 524-3303 -

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message WOLF, PATRICK 2000-08-14 15:37:56 RE: Select problem
Previous Message Karl F. Larsen 2000-08-14 15:29:54 Select problem