Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement