Created
November 12, 2016 15:52
-
-
Save kevincolten/5d9e7c92aa086e231612fd81ce78e6ec to your computer and use it in GitHub Desktop.
All students and their payments
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 users.id, users.first_name, users.last_name, users.email, stripe_payments.customer, stripe_payments.source, CAST(SUM(stripe_payments.amount) as FLOAT) / 100 | |
FROM users | |
JOIN stripe_payments as sp ON INSTR(sp.source, users.email) > 0 | |
JOIN stripe_payments ON users.customer_id = stripe_payments.customer | |
WHERE stripe_payments.customer != '' | |
AND sp.customer = '' | |
GROUP BY users.email; | |
/* SELECT users.id, users.first_name, users.last_name, users.email, stripe_payments.customer, stripe_payments.source, CAST(SUM(stripe_payments.amount) as FLOAT) / 100 | |
FROM users | |
JOIN stripe_payments ON INSTR(stripe_payments.source, users.email) > 0 | |
WHERE stripe_payments.customer = '' | |
GROUP BY users.email; */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment