Created
April 5, 2012 05:58
-
-
Save andrewpurcell/2308335 to your computer and use it in GitHub Desktop.
select a winner for sentegy
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 * FROM | |
( | |
SELECT DISTINCT comfortfeedback.PersonID, | |
COUNT(comfortfeedback.PersonID) as c, | |
people.name, | |
people.email | |
FROM comfortfeedback, people | |
WHERE comfortfeedback.TimeStamp >= DATE('2012-3-26') | |
AND people.PersonID = comfortfeedback.PersonID GROUP BY PersonID | |
) as t1 | |
WHERE c >= 4 | |
ORDER BY rand() | |
LIMIT 1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment