Hi All,
SQL is something very new to me and I'm struggling with the following case:
There are two tables:
- "Account" (containing information for account numbers and their respective owners - "Entity")
- "Agreements" (containing information for agreements an account or entity may have) -- account or entity name also present in this table.
- One account or entity may have several agreements and one entity may own several accounts.
I have no problem running separate queries using either "Account Number" or "Entity" as KEY to extract all relevant agreements, however I would like to combine the two into just one query.
My goal is to tell SQL:
if "Account Number" not in "Agreements" then
substitute "Account Number" with "Entity" (owner)
Else:
populate agreements for "Account Number"
Thanks in advance !
SQL is something very new to me and I'm struggling with the following case:
There are two tables:
- "Account" (containing information for account numbers and their respective owners - "Entity")
- "Agreements" (containing information for agreements an account or entity may have) -- account or entity name also present in this table.
- One account or entity may have several agreements and one entity may own several accounts.
I have no problem running separate queries using either "Account Number" or "Entity" as KEY to extract all relevant agreements, however I would like to combine the two into just one query.
My goal is to tell SQL:
if "Account Number" not in "Agreements" then
substitute "Account Number" with "Entity" (owner)
Else:
populate agreements for "Account Number"
Thanks in advance !