Last active
April 16, 2019 09:38
-
-
Save prestigegodson/ea7a30b845f61316b0b87dac0ff99f44 to your computer and use it in GitHub Desktop.
Philip
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 pr.id, coalesce(acc_bal.balance,0.00) as "Amount Paid", | |
pr.title as "Project Title", | |
(select coalesce(sum(amount),0.00) from pledge where project_id = pr.id) as "Amount Pledged", | |
(select count(*) from pledge where project_id = pr.id) as "Pledge count", | |
(select count(*) from account_history where account_id = acc.id) as "Payment count" | |
from project pr | |
join account acc | |
on pr.id = acc.project_id | |
left join account_balance acc_bal | |
on acc.id = acc_bal.account_id | |
where pr.is_deleted = 0; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment