Created
May 24, 2019 16:18
-
-
Save julestruong/c98b8e4ac1705822739dabb8b7bd35db to your computer and use it in GitHub Desktop.
offers nb moderation by month
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 | |
COUNT(count), | |
month | |
FROM | |
(SELECT COUNT(1) count, DATE_FORMAT(logged_at, '%Y-%m') month | |
FROM office_offer oo | |
INNER JOIN office_offer_log log ON log.object_id = oo.id | |
WHERE JSON_CONTAINS(log.data, '"moderation"', '$.state') | |
GROUP BY oo.id, month | |
) sub | |
GROUP BY month; | |
SELECT | |
COUNT(count), | |
month | |
FROM | |
(SELECT COUNT(1) count, DATE_FORMAT(logged_at, '%Y-%m') month | |
FROM room_offer ro | |
INNER JOIN office_offer_log log ON log.object_id = ro.id | |
WHERE JSON_CONTAINS(log.data, '"moderation"', '$.state') | |
GROUP BY ro.id, month | |
) sub | |
GROUP BY month |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment