Re: Can't seem to mix an inner and outer join in a query and get it to work right.

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: Can't seem to mix an inner and outer join in a query and get it to work right.
Дата
Msg-id CAKFQuwbmk4R9yBYy+EE9+=5PeNx3rWrGsDfqEFLOEBe3wLGMpA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Can't seem to mix an inner and outer join in a query and get it to work right.  (David Gauthier <davegauthierpg@gmail.com>)
Список pgsql-general
The convention here is to bottom post or inline responses.

On Wed, Jul 1, 2020 at 9:51 AM David Gauthier <davegauthierpg@gmail.com> wrote:
Actually, I want the outer join first.  If it finds something, then move on to the inner join and filter out all those that don't join to a rec with 'autosmoke'.  But if the outer join does not connect to the workarea_env table, then just return what you have (the purpose of the outer join)


So your final result - ignoring columns - is basically:
(sqf, (workarea, events))

where either the entire (workarea, events) is null, or if it is non-null then workarea must also be non-null

Thus: ((workarea is left joined against events) with the whole thing left joined against sqf).  And we are back to the join ordering precedence since what you originally wrote was ((sqf, workarea), events).

In short - two outer joins; you can work out precedence either with syntactic order or parentheses.

David J.

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

Предыдущее
От: FOUTE K. Jaurès
Дата:
Сообщение: Re: PostgreSQL 12 - ERROR: could not rename file "pg_logical/snapshots/1A-7C00D890.snap.13594.tmp" to "pg_logical/snapshots/1A-7C00D890.snap": No space left on device
Следующее
От: FOUTE K. Jaurès
Дата:
Сообщение: Re: PostgreSQL 12 - ERROR: could not rename file "pg_logical/snapshots/1A-7C00D890.snap.13594.tmp" to "pg_logical/snapshots/1A-7C00D890.snap": No space left on device