Re: Select problem

From: "Karl F(dot) Larsen" <k5di(at)zianet(dot)com>
To: Joe LaLumiere <joelight(at)tiac(dot)net>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Select problem
Date: 2000-08-14 17:23:12
Message-ID: Pine.LNX.4.10.10008141120200.1275-100000@cannac.ampr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice


You are exactly right Joe. Thanks and I found another way which
sometimes works. It goes

select data.* , user
from......

when you want all from table "data" and user from another.

On Mon, 14 Aug 2000, Joe LaLumiere wrote:

> >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?
>
> Since you have two tables which have the same field name you need to specify which table to grab the field from. The corrected select statement would be:
>
> select user, user.armycall
> from data, biglist
> where user.armycall = biglist.armycall
>
> OR
>
> select user, biglist.armycall
> from data, biglist
> where user.armycall = biglist.armycall
>
> Either of these two will work. The above applies to any two fields which have the same name in two or more tables.
>
> Joe LaLumiere
>
> >
> >Yours Truly,
> >
> > - Karl F. Larsen, k5di(at)arrl(dot)net (505) 524-3303 -
> >
> >
> >
> ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
> \ Joseph LaJeunesse-LaLumiere / Phone: (781) 276-6816 \ TIAC - The Internet Access Company /
> \ Systems Administrator I / Pager: (617) 473-2573 \ - A Division of Inter.net /
> \ Inter.net - Bedford MA / Email: joelight(at)tiac(dot)net \ /
> ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
>
>

Yours Truly,

- Karl F. Larsen, k5di(at)arrl(dot)net (505) 524-3303 -

Browse pgsql-novice by date

  From Date Subject
Next Message Eduardo Kotujansky 2000-08-14 18:35:56 kdevelop -> libpq-fe.h
Previous Message John McKown 2000-08-14 16:35:29 Re: Select problem