Guest User

Untitled

a guest
Jan 22nd, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.75 KB | None | 0 0
  1. SELECT
  2.                 '$start_date' AS donation_week,
  3.                 COUNT(Donation.id) AS donation_count,
  4.                 COUNT(Donation.id) *3  AS donation_amount,
  5.                 COUNT(ThreeweekVote.DATE) AS challenge_vote,
  6.                 COUNT(Challenge.id) AS challenge_charities,
  7.                 Donation.*,
  8.                 Challenge.*
  9.             FROM
  10.                     donations Donation
  11.             LEFT  JOIN challenges      Challenge     ON Donation.challenge_id      = Challenge.id
  12.             LEFT  JOIN threeweek_votes ThreeweekVote ON ThreeweekVote.challenge_id = Challenge.id  
  13.             WHERE
  14.                     Donation.created  >= '$start_date'
  15.                 AND Donation.created   < '$end_date'
  16.                 AND Donation.SOURCE    = 'ThreeWeekly'
  17.                 AND Donation.state    <> 'Cancelled'
  18.             -- GROUP BY Challenge.id
Add Comment
Please, Sign In to add comment