Title: SQL Syntax Error when deleting post
Last modified: August 18, 2016

---

# SQL Syntax Error when deleting post

 *  [Robert Accettura](https://wordpress.org/support/users/robertaccettura/)
 * (@robertaccettura)
 * [20 years, 5 months ago](https://wordpress.org/support/topic/sql-syntax-error-when-deleting-post/)
 * Get the following error when trying to delete a post:
 * 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‘
   ON (wp_posts.ID = .post_id) WHERE post_date > 0 AND category_id <> 0 ‘ at line
   4]
    SELECT tag_id FROM wp_posts INNER JOIN wp_post2cat ON (wp_posts.ID = wp_post2cat.
   post_id) INNER JOIN ON (wp_posts.ID = .post_id) WHERE post_date > 0 AND category_id
   <> 0 AND ID = 931 ORDER By post_date DESC
 * 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 <> 0 AND p.post_date_gmt < ‘2005-12-28 05:38:03’ ‘ 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
   <> 0 AND p.post_date_gmt < ‘2005-12-28 05:38:03’ ORDER By p.post_date DESC

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Mark (podz)](https://wordpress.org/support/users/podz/)
 * (@podz)
 * [20 years, 5 months ago](https://wordpress.org/support/topic/sql-syntax-error-when-deleting-post/#post-302618)
 * Version of WP ?
 *  Thread Starter [Robert Accettura](https://wordpress.org/support/users/robertaccettura/)
 * (@robertaccettura)
 * [20 years, 5 months ago](https://wordpress.org/support/topic/sql-syntax-error-when-deleting-post/#post-302749)
 * 2.0

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘SQL Syntax Error when deleting post’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [Robert Accettura](https://wordpress.org/support/users/robertaccettura/)
 * Last activity: [20 years, 5 months ago](https://wordpress.org/support/topic/sql-syntax-error-when-deleting-post/#post-302749)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
