Skip to content

Instantly share code, notes, and snippets.

@barrychapman
Created June 22, 2012 18:37
Show Gist options
  • Save barrychapman/2974435 to your computer and use it in GitHub Desktop.
Save barrychapman/2974435 to your computer and use it in GitHub Desktop.
SELECT
DATE(DATE_ADD(NOW(), INTERVAL 2 DAY)) as `period_date`,
PrjPledge.id,
User.id,
Project.id
FROM
receivables AS Receivable
LEFT JOIN
prj_pledges AS PrjPledge ON (Receivable.pledge_id = PrjPledge.id)
LEFT JOIN
users AS User ON (Receivable.user_id = User.id)
LEFT JOIN
projects AS Project ON (Receivable.project_id = Project.id)
WHERE
HOUR(Receivable.due_by_date) = '14' AND
due_by_date <= `period_date` AND
due_by_date >= '2012-06-22 18:20:55' AND
Receivable.settled = 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment