Created
May 3, 2019 13:57
-
-
Save prestigegodson/87f377c1e0050d5c6821f795cd4bd6c3 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 au.first_name, au.last_name, au.email, p.user_id as "User Id", p.id as "Pledge Id", p.amount as "Pledged Amount", | |
(select coalesce(sum(pr.amount), 0) from pledge_redemption pr where p.id = pr.pledge_id) as "Paid Amount" | |
from pledge p | |
join auth_user au on au.id = p.user_id | |
where p.amount > (select coalesce(sum(pr.amount), 0) from pledge_redemption pr where p.id = pr.pledge_id); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment