-
Notifications
You must be signed in to change notification settings - Fork 76
Open
Description
WP Version: 6.8.3
PG4WP Version: 3.4.1
Error:
ERROR: syntax error at or near "FROM"
LINE 1: ...onth, count( "ID" ) as posts, month ORDER BY year FROM wp_po...
RAW SQL
SELECT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM wp_posts INNER JOIN wp_term_relationships AS pll_tr ON pll_tr.object_id = wp_posts.ID WHERE post_type = 'post' AND post_status = 'publish' AND pll_tr.term_taxonomy_id = 8 GROUP BY `year`, `month` ORDER BY `year` DESC, `month` DESC
Expected Rewritten SQL
SELECT EXTRACT(YEAR FROM post_date) AS year, EXTRACT(MONTH FROM post_date) AS month, count( "ID" ) as posts FROM wp_posts INNER JOIN wp_term_relationships AS pll_tr ON pll_tr.object_id = wp_posts."ID" WHERE post_type = 'post' AND post_status = 'publish' AND pll_tr.term_taxonomy_id = 8 GROUP BY year, month ORDER BY year DESC, month DESC
Actual Rewritten SQL
SELECT EXTRACT(YEAR FROM post_date) AS year, EXTRACT(MONTH FROM post_date) AS month, count( "ID" ) as posts, month ORDER BY year FROM wp_posts GROUP BY EXTRACT(YEAR FROM post_date) AS year, EXTRACT(MONTH FROM post_date) AS month, month ORDER BY year
It seems as if another variable was used instead of the "INNER JOIN..." part.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels