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

Re: Select problem

From: John McKown <jmckown(at)prodigy(dot)net>
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 16:35:29
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
On Mon, 14 Aug 2000, 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  -

You need to tell the SELECT which armycall you want since it is in both
tables. Yes, the values are identical due to the WHERE clause, but the
parser really doesn't know this. So try:

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

Note - I think you have a transcription error in your example because you
said user.armycall, not data.armycall in the WHERE clause. 

Anyway, I hope this helps,

In response to

pgsql-novice by date

Next:From: Karl F. LarsenDate: 2000-08-14 17:23:12
Subject: Re: Select problem
Previous:From: NRonayetteDate: 2000-08-14 15:55:44
Subject: Re: Select problem

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