-
-
Save julestruong/cb698c8da018b635d9d67cdcea8aa9e8 to your computer and use it in GitHub Desktop.
offers moderated more than once
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 | |
COUNT(count) nb_remoderation, | |
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 DATE_FORMAT(logged_at, '%Y-%m'), oo.id | |
HAVING Count(1) > 1 | |
) sub | |
-- WHERE sub.month ="2018-01" | |
GROUP BY month; | |
SELECT | |
COUNT(count) nb_remoderation, | |
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 DATE_FORMAT(logged_at, '%Y-%m'), ro.id | |
HAVING Count(1) > 1 | |
) sub | |
-- WHERE sub.month ="2018-01" | |
GROUP BY month |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment