Re: [GENERAL] Left join help - Mailing list pgsql-general

From David G. Johnston
Subject Re: [GENERAL] Left join help
Date
Msg-id CAKFQuwYdx_+fkiWTiszpGRGm2C8xhhwEVDuo+o0Jps+JQmH7Sw@mail.gmail.com
Whole thread Raw
In response to Re: [GENERAL] Left join help  (Arup Rakshit <aruprakshit1987@outlook.com>)
List pgsql-general
On Fri, Jun 23, 2017 at 3:17 PM, Arup Rakshit <aruprakshit1987@outlook.com> wrote:
Hi David,

Can you tell me how can I add ordering between LEFT and INNER JOIN. I think also that is where I am wrong, but not sure how to correct the ordering.

​Generally...

FROM tbl1 LEFT JOIN (tbl2 JOIN ​tbl3 ON ...) tbl2_3 ON ...

In short, put parentheses around the join and give it an alias.

There are ordering rules that can be considered too but frankly I've never learned them and haven't noticed their absence.  The above is the explicit way to do things and explicit is generally better.

David J.

pgsql-general by date:

Previous
From: Paul Jungwirth
Date:
Subject: Re: [GENERAL] Left join help
Next
From: Arup Rakshit
Date:
Subject: Re: [GENERAL] Left join help