Created
June 16, 2017 17:30
-
-
Save jmiramant/f92d27cdff4dc72470cbc8909bf50d56 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
CNTC.ContactID, | |
CF.FocusInstanceID, | |
group_concat(DISTINCT Country.name SEPARATOR ', ') AS country, | |
group_concat(DISTINCT EquityInstrument.name SEPARATOR ', ') AS equityInstrument, | |
FROM | |
ContactFocus AS CF | |
JOIN | |
Contact AS CNTC | |
ON CF.ContactID = CNTC.ContactID | |
LEFT JOIN | |
ContactFocusCountry | |
ON CF.ContactID = ContactFocusCountry.ContactID | |
LEFT JOIN | |
Country | |
ON Country.CountryID = ContactFocusCountry.CountryID | |
LEFT JOIN | |
ContactFocusEquityInstrument | |
ON CF.ContactID = ContactFocusEquityInstrument.ContactID | |
LEFT JOIN | |
EquityInstrument | |
ON EquityInstrument.EquityInstrumentID = ContactFocusEquityInstrument.EquityInstrumentID | |
WHERE | |
CNTC.ContactID = 433504 | |
GROUP BY | |
CF.FocusInstanceID; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment