Re: Select problem - Mailing list pgsql-novice

From Chris Ryan
Subject Re: Select problem
Date
Msg-id 399811D8.3A5EA78A@greatbridge.com
Whole thread Raw
In response to Select problem  ("Karl F. Larsen" <k5di@zianet.com>)
List 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@greatbridge.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@arrl.net  (505) 524-3303  -

pgsql-novice by date:

Previous
From: patrick.wolf@Aerojet.com (WOLF, PATRICK)
Date:
Subject: RE: Select problem
Next
From: NRonayette
Date:
Subject: Re: Select problem