Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT
- '$start_date' AS donation_week,
- COUNT(Donation.id) AS donation_count,
- COUNT(Donation.id) *3 AS donation_amount,
- COUNT(ThreeweekVote.DATE) AS challenge_vote,
- COUNT(Challenge.id) AS challenge_charities,
- Donation.*,
- Challenge.*
- FROM
- donations Donation
- LEFT JOIN challenges Challenge ON Donation.challenge_id = Challenge.id
- LEFT JOIN threeweek_votes ThreeweekVote ON ThreeweekVote.challenge_id = Challenge.id
- WHERE
- Donation.created >= '$start_date'
- AND Donation.created < '$end_date'
- AND Donation.SOURCE = 'ThreeWeekly'
- AND Donation.state <> 'Cancelled'
- -- GROUP BY Challenge.id
Add Comment
Please, Sign In to add comment