Re: SQL "OR" Problem

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: SQL "OR" Problem
Дата
Msg-id 20050826131954.D29460@megazone.bigpanda.com
обсуждение исходный текст
Ответ на SQL "OR" Problem  (<operationsengineer1@yahoo.com>)
Список pgsql-novice
On Fri, 26 Aug 2005 operationsengineer1@yahoo.com wrote:

> hi all,
>
> i'm trying to populate a list box with the names of
> employees linked to certain positions (each name
> listed once)...
>
> SELECT DISTINCT t_emp.emp_id, t_emp.first_name || ' '
> || t_emp.last_name, t_pos.pos
>
> FROM t_inspect, t_emp, t_pos
> WHERE t_emp.pos_id = t_pos.pos_id
> AND t_inspect.inspect_emp_id = t_emp.emp_id
> AND t_pos.pos = 'Assembler'
> OR t_pos.pos = 'Quality Inspector'
> OR t_pos.pos = 'Test Technician'


Have you tried it with parens?  I'm guessing you probably wanted something
more like:

WHERE t_emp.pos_id = t_pos.pos_id
 AND t_inspect.inspect_emp_id = t_emp.emp_id
 AND (t_pos.pos = 'Assembler'
  OR t_pos.pos = 'Quality Inspector'
  OR t_pos.pos = 'Test Technician')


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: SQL "OR" Problem
Следующее
От: Bruno Wolff III
Дата:
Сообщение: Re: SQL safe input?