Title: long strange SQL error
Last modified: August 18, 2016

---

# long strange SQL error

 *  [pintsize](https://wordpress.org/support/users/pintsize/)
 * (@pintsize)
 * [19 years, 2 months ago](https://wordpress.org/support/topic/long-strange-sql-error/)
 * 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 p2c.category_id <> 1 AND p2c.category_id <> 2 AND p2c.category_id <> 3 AN’
   at line 5]
    SELECT DISTINCT MONTH(p.post_date) AS `month` FROM wp_posts p INNER
   JOIN wp_post2cat p2c ON (p.ID = p2c.post_id ) WHERE YEAR(p.post_date) = AND p2c.
   category_id <> 1 AND p2c.category_id <> 2 AND p2c.category_id <> 3 AND p2c.category_id
   <> 4 AND p2c.category_id <> 5 AND p2c.category_id <> 6 AND p2c.category_id <>
   7 AND p2c.category_id <> 8 AND p2c.category_id <> 9 AND p2c.category_id <> 10
   AND p2c.category_id <> 11 AND p2c.category_id <> 13 AND p2c.category_id <> 14
   AND p2c.category_id <> 15 AND
 * it goes on like this for many lines
 * last line is:
    p2c.category_id <> 533 AND p.post_date_gmt < ‘2007-03-27 04:19:
   26’ ORDER By p.post_date DESC

The topic ‘long strange SQL error’ is closed to new replies.

## Tags

 * [sql](https://wordpress.org/support/topic-tag/sql/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [pintsize](https://wordpress.org/support/users/pintsize/)
 * Last activity: [19 years, 2 months ago](https://wordpress.org/support/topic/long-strange-sql-error/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
