Forums

[resolved] SQL Syntax Error (2 posts)

  1. bcreighton
    Member
    Posted 5 years ago #

    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) AS year, MONTH(post_date) AS month, 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);

  2. bcreighton
    Member
    Posted 5 years ago #

    got it - wasn't carrying the catid over... :D

Topic Closed

This topic has been closed to new replies.

About this Topic