Last active
August 29, 2015 14:16
-
-
Save asvechkar/0e97bd133ee6f1aa7714 to your computer and use it in GitHub Desktop.
Clients
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 | |
| uc.user_id AS Id, | |
| uc.client_name AS name, | |
| lc.law_full_name AS fullname, | |
| us.username AS phone, | |
| us.email, | |
| lc.inn, | |
| lc.ogrn, | |
| cba.account_num AS account, | |
| b.bank_name AS bank, | |
| b.bank_bik AS bik, | |
| sl.status_name AS status, | |
| ust.status_date AS activated_at, | |
| ad.city, | |
| ad.zip_code AS zipcode | |
| FROM | |
| users_clients AS uc | |
| LEFT JOIN users AS us ON us.id = uc.user_id | |
| LEFT JOIN law_clients lc ON lc.user_id = uc.user_id | |
| LEFT JOIN clients_banks_accounts AS cba ON cba.user_id = uc.user_id | |
| LEFT JOIN banks AS b ON b.bank_id = cba.bank_id | |
| LEFT JOIN users_statuses AS ust ON ust.user_id = uc.user_id | |
| AND ust.status_id = 14 | |
| AND ust.is_active = 1 | |
| LEFT JOIN statuses_list AS sl ON sl.status_id = ust.status_id | |
| LEFT JOIN users_addresses AS ua ON ua.user_id = uc.user_id | |
| AND ua.address_type = 2 | |
| LEFT JOIN addresses AS ad ON ad.address_id = ua.address_id |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment