SQL Syntax Error
-
I’m working on archives by date and category (http://wordpress.org/support/topic/69776?replies=13) and I have an SQL Syntax error. My mySQL knowledge is fairly limited, can anyone spot the error? Thanks!
$arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) ASyear, MONTH(post_date) ASmonth, count(ID) as posts FROM $wpdb->posts, $wpdb->post2cat WHERE id = post_id AND post_date < '$now' AND category_id = $mcat AND post_date != '0000-00-00 00:00:00' AND post_status = 'publish' GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC" . $limit);
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘SQL Syntax Error’ is closed to new replies.