Title: Database error when deleting draft posts
Last modified: August 18, 2016

---

# Database error when deleting draft posts

 *  [mattmend](https://wordpress.org/support/users/mattmend/)
 * (@mattmend)
 * [19 years, 9 months ago](https://wordpress.org/support/topic/database-error-when-deleting-draft-posts/)
 * I had a couple of draft posts that mysteriously appeared. I tried deleting each
   one and while the delete appeared to be successful, I did get the following error
   each time:
 * >  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 p.post_date_gmt < ‘2006-09-19 13:36:55′ ORDER By p.post_date 
   > DESC’ at line 6]
   >  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 p.post_date_gmt < ‘2006-09-19 13:36:55’ ORDER By p.post_date DESC
 * Any ideas? This is WP 2.04.

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

 *  [Chris_K](https://wordpress.org/support/users/handysolo/)
 * (@handysolo)
 * [19 years, 9 months ago](https://wordpress.org/support/topic/database-error-when-deleting-draft-posts/#post-454513)
 * The offending bit is `WHERE YEAR(p.post_date) = AND` which is quite odd. Lost
   the date it would appear.
 * How did you do the deletions of the draft posts?
 *  Thread Starter [mattmend](https://wordpress.org/support/users/mattmend/)
 * (@mattmend)
 * [19 years, 9 months ago](https://wordpress.org/support/topic/database-error-when-deleting-draft-posts/#post-454521)
 * I first clicked ‘edit’ from the manage screen. Then clicked ‘delete post’ at 
   the bottom of the ‘write post’ page.

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

The topic ‘Database error when deleting draft posts’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [mattmend](https://wordpress.org/support/users/mattmend/)
 * Last activity: [19 years, 9 months ago](https://wordpress.org/support/topic/database-error-when-deleting-draft-posts/#post-454521)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
