Created
May 25, 2017 16:09
-
-
Save emilsedgh/d602d37c14794236f4fac3a3c8088bcc to your computer and use it in GitHub Desktop.
This file contains 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 DISTINCT agents.id AS id FROM agents | |
LEFT JOIN users ON agents.id = users.agent | |
LEFT JOIN offices ON agents.office_mui = offices.matrix_unique_id | |
LEFT JOIN brands_offices ON offices.id = brands_offices.office | |
LEFT JOIN brands_users ON users.id = brands_users.user | |
WHERE ( | |
( | |
brands_offices.brand = '745e77aa-4ddf-11e6-a07d-f23c91b0d077' | |
) | |
OR | |
( | |
brands_users.brand = '745e77aa-4ddf-11e6-a07d-f23c91b0d077' | |
) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment