Drupal 9: MySQL Query To Count The Number Of Articles Created Per Week
11th December 2022
SELECT YEAR(FROM_UNIXTIME(created)) as year, MONTH(FROM_UNIXTIME(created)) as month, WEEK(FROM_UNIXTIME(created)) as week, count(1), group_concat(FROM_UNIXTIME(created))
FROM `node_field_data`
WHERE status = 1 and type = 'article'
GROUP BY YEAR(FROM_UNIXTIME(created)), MONTH(FROM_UNIXTIME(created)), WEEK(FROM_UNIXTIME(created))
ORDER BY YEAR(FROM_UNIXTIME(created)) DESC, MONTH(FROM_UNIXTIME(created)) DESC, WEEK(FROM_UNIXTIME(created)) DESC;
Add new comment