Created
June 8, 2016 15:12
-
-
Save iantanwx/343f7893cd620f5bb977c4db16c62cab to your computer and use it in GitHub Desktop.
SQL
This file contains hidden or 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 date AS day, | |
COUNT(CASE WHEN score >= 0.00 THEN 1 ELSE NULL END) AS num_pos_scores, | |
COUNT(CASE WHEN score < 0.00 THEN 1 ELSE NULL END) AS num_neg_scores | |
FROM assessments | |
WHERE is_date >= STR_TO_DATE('2011-03-01', '%Y-%m-%d') | |
AND is_date <= STR_TO_DATE('2011-04-30', '%Y-%m-%d') | |
GROUP BY DATE(date); | |
SELECT date AS day | |
FROM assessments | |
WHERE score >= 0 | |
AND date >= STR_TO_DATE('2011-01-01') | |
AND date <= STR_TO_DATE('2011-06-30') | |
GROUP BY DATE(date); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment