Re: Need assistance with JOIN SQL

From: Ed Prochak <edprochak_at_gmail.com>
Date: Sun, 30 Dec 2018 12:35:31 -0800 (PST)
Message-ID: <a48b4f35-ddbd-4b84-9894-b578c8b46b0c_at_googlegroups.com>


Hi Paul,

I took a look at your joins. Now this is without knowing anything about your tables, only looking at the query you posted. So it seems that perhaps your outer join is backwards.

On Tuesday, December 11, 2018 at 11:07:17 AM UTC-5, paul.wi..._at_gmail.com wrote:
>
> SELECT "ORG_ACCOUNT".ACCOUNT_NUMBER AS "Account Number",
[]
> WHERE ( ( "ORG_PERSON".PERSON_ID(+) = "ORG_ALT_ACCOUNT_CUST".PERSON_ID )
This selects all rows of ORG_ALT_ACCOUNT_CUST, whether there is a matching ORG_PERSON row or not. Now, assuming that there is a person that owns(?) each alternate account, this will only return person rows that have one or more Alt Accounts.

So I think you really want
 WHERE ( ( "ORG_PERSON".PERSON_ID = "ORG_ALT_ACCOUNT_CUST".PERSON_ID(+) ) which should return all persons that match all the other criteria in your query whether or not they have an alternate account.

But again, this is a total guess based only on your query given earlier. Some information about the keys, foreign keys and other constraints on those tables would be helpful for us to assist you.

Good luck.
  Ed Received on Sun Dec 30 2018 - 21:35:31 CET

Original text of this message