pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: stan <stanb@panix.com>
To: Michael Lewis <mlewis@entrata.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: A JOIN question
Date: Mon, 30 Dec 2019 17:13:23 -0500
Message-ID: <20191230221323.GA2064@panix.com> (raw)
In-Reply-To: <CAHOFxGrpoBSWT=0QwxjtQPSmTqr6awcV3TBOGx=t5p7Pj9fncQ@mail.gmail.com>
References: <20191230213110.GA4475@panix.com>
	<CAHOFxGrpoBSWT=0QwxjtQPSmTqr6awcV3TBOGx=t5p7Pj9fncQ@mail.gmail.com>


On Mon, Dec 30, 2019 at 02:47:53PM -0700, Michael Lewis wrote:
> >
> > LEFT join mfg_vendor_relationship on
> >         mfg_vendor_relationship.mfg_key = mfg_part.mfg_key
> >         AND
> >         mfg_vendor_relationship.project_key = bom_item.project_key
> > LEFT join vendor on
> >         mfg_vendor_relationship.vendor_key = vendor.vendor_key
> >
> 
> Perhaps I am missing something, but it seems like just a matter of changing
> inner join to left so you keep what you already have and augment vendor
> information when it exists. I never use right joins (I re-write to always
> declare as left) so I am not sure if the right join near the top screws
> that up. I might consider using a UNION ALL to combine sets where values
> are NULL with left joins, and use plain (inner) joins for the not nulls.

Thanks. That looks like it gives me what I need.

RE right joins, I just got started doing that, and it is easier for me to
think that way.

-- 
"They that would give up essential liberty for temporary safety deserve
neither liberty nor safety."
						-- Benjamin Franklin





view thread (3+ messages)

Message-ID: <20191230221323.GA2064@panix.com>
Permalink:  ../20191230221323.GA2064@panix.com/
Also on:    postgresql.org/message-id/20191230221323.GA2064@panix.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: stanb@panix.com, mlewis@entrata.com
  Subject: Re: A JOIN question
  In-Reply-To: <20191230221323.GA2064@panix.com>
  References: <20191230213110.GA4475@panix.com> <CAHOFxGrpoBSWT=0QwxjtQPSmTqr6awcV3TBOGx=t5p7Pj9fncQ@mail.gmail.com> <20191230221323.GA2064@panix.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox