Skip site navigation (1) Skip section navigation (2)

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: (view raw, whole thread or download thread mbox)
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

"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

pgsql-novice by date

Next:From: WOLF, PATRICKDate: 2000-08-14 15:37:56
Subject: RE: Select problem
Previous:From: Karl F. LarsenDate: 2000-08-14 15:29:54
Subject: Select problem

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group