Re: Complex query need help with OR condition.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Complex query need help with OR condition.
Дата
Msg-id 10254.1098678910@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Complex query need help with OR condition.  (Ken Tozier <kentozier@comcast.net>)
Ответы Re: Complex query need help with OR condition.
Список pgsql-general
Ken Tozier <kentozier@comcast.net> writes:
> When I add the OR clause things go haywire:

> SELECT a.paginator, a.doc_name, (b.time - pm_events.time) as
> elapsed_time FROM pm_events as a, pm_events as b
>     WHERE a.event_code='pmcd'
>     OR a.event_code='pmop'
>     AND b.event_code='pmcl'
>     AND a.doc_name=b.doc_name
>     AND a.paginator=b.paginator
>     AND a.time < b.time

I think you need some parentheses, or at least a bit of thought about
what the OR is binding to.

            regards, tom lane

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

Предыдущее
От: Ken Tozier
Дата:
Сообщение: Complex query need help with OR condition.
Следующее
От: Ken Tozier
Дата:
Сообщение: Re: Complex query need help with OR condition.