error:05
SELECT wp_posts.ID ,SUBSTRING( wp_posts.post_date, 1, 4 ) YEAR ,SUBSTRING( wp_posts.post_date, 6, 2 ) MONTH ,SUBSTRING( wp_posts.post_date, 9, 2 ) DAY ,wp_posts.post_title ,wp_posts.post_content ,wp_posts.post_status ,wp_post2cat.category_id FROM wp_posts LEFT JOIN wp_post2cat ON wp_posts.ID = wp_post2cat.post_id GROUP BY wp_posts.ID,YEAR,MONTH,DAY,wp_posts.post_title,wp_posts.post_content,wp_posts.post_status,wp_post2cat.category_id HAVING wp_post2cat.category_id ='4' AND wp_posts.post_status ='publish' AND wp_posts.ID = ORDER BY YEAR DESC,MONTH DESC,DAY DESC
1064: 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 'ORDER BY YEAR DESC,MONTH DESC,DAY DESC' at line 1