Last active
September 25, 2019 17:05
-
-
Save AhmedSamy/7013721675246ee20e173de0bf100aae to your computer and use it in GitHub Desktop.
PSD2 users
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 ut.created_at AS "Time", bp.`bank_data_provider_id`, cs.name, uc.user_id, u.email | |
FROM `users_transitions` ut | |
LEFT JOIN `users_companies` uc ON uc.user_id = ut.object_id | |
LEFT JOIN companies c ON uc.company_id = c.id | |
LEFT JOIN `customer_bank_accounts` cba ON cba.customer_uuid = c.uuid | |
LEFT JOIN `bank_account_bank_data_providers` bp ON bp.`bank_account_id` = cba.bank_account_id AND bp.state = "connected" AND bp.is_active= 1 | |
LEFT JOIN `company_snapshots` cs ON cs.company_id = c.id AND cs.is_current = 1 | |
LEFT JOIN users u ON u.id = uc.user_id | |
WHERE ut.`to_state` ="bank_account_connected" | |
AND ut.created_at > "2019-09-19 00:00:00" | |
GROUP BY cba.customer_uuid; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment