RE: ambiguous

From: "Riebs, Andy" <Andy(dot)Riebs(at)compaq(dot)com>
To: "'s(at)remail(dot)net'" <s(at)remail(dot)net>, pgsql-general(at)postgresql(dot)org
Subject: RE: ambiguous
Date: 2001-03-07 15:58:53
Message-ID: F65B33CAD23A284EAE6E4AE353BF94DC0C25B5@tayexc13.americas.cpqcorp.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> select * from DEPARTMENT, Employee where dept_no = '1';
>
> PG throws up:
> ERROR: Column 'dept_no' is ambiguous
>
> Is this not allowed? or is my sql understanding wrong?

While a human can determine that it doesn't matter if you use
DEPARTMENT.dept_no or Employee.dept_no in this query, it would
require an extremely talented parser to recognize that.

What you probably want is something like

select * from DEPARTMENT, Employee where DEPARTMENT.dept_no=1
and DEPARTMENT.dept_no=Employee.dept_no;

/andy

---
Andy Riebs, andy(dot)riebs(at)compaq(dot)com Alpha Technology Solutions Group
978-506-6628, fax 978-506-6524 Compaq Computer Corporation
(h) ariebs(at)earthlink(dot)net <http://www.linuxalpha.compaq.com>
<http://osdb.sourceforge.net/>

Browse pgsql-general by date

  From Date Subject
Next Message Richard Poole 2001-03-07 16:07:23 Re: ambiguous
Previous Message Tom Lane 2001-03-07 15:42:46 Re: Why are tables sizes so big?