WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND p.post_type = 'post'
AND p.post_date >= DATE('1974-12-31 00:00:00'' at line 14]
SELECT tbl.y year, group_concat(month_posts ORDER BY tbl.m DESC SEPARATOR '-') months
FROM (
SELECT YEAR(p.post_date) y, MONTH(p.post_date) m, concat(MONTH(p.post_date), ':', group_concat(p.id ORDER BY p.post_date DESC )) month_posts
FROM wp_1pafhx9kd7_posts p
JOIN wp_1pafhx9kd7_term_relationships tr ON (p.ID = tr.object_id)
JOIN wp_1pafhx9kd7_term_taxonomy tt ON (tr.term_taxonomy_id = tt.term_taxonomy_id)
JOIN wp_1pafhx9kd7_terms t ON (tt.term_id = t.term_id)
WHERE (p.post_status = 'publish' OR p.post_status = 'future')
AND tt.taxonomy = 'category'
AND t.term_id =
AND p.post_type = 'post'
AND p.post_date >= DATE('1974-12-31 00:00:00')
GROUP BY y, m
) tbl
GROUP BY tbl.y
ORDER BY tbl.y DESC