RE: ambiguous

Поиск
Список
Период
Сортировка
От Riebs, Andy
Тема RE: ambiguous
Дата
Msg-id F65B33CAD23A284EAE6E4AE353BF94DC0C25B5@tayexc13.americas.cpqcorp.net
обсуждение исходный текст
Ответ на ambiguous  (si <s@remail.net>)
Список 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.riebs@compaq.com      Alpha Technology Solutions Group
978-506-6628, fax 978-506-6524         Compaq Computer Corporation
(h) ariebs@earthlink.net               <http://www.linuxalpha.compaq.com>
<http://osdb.sourceforge.net/>

В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Why are tables sizes so big?
Следующее
От: "Brett W. McCoy"
Дата:
Сообщение: Re: ambiguous