Title: SQL Syntax error on missing post
Last modified: August 18, 2016

---

# SQL Syntax error on missing post

 *  [Dalton Rooney](https://wordpress.org/support/users/daltonrooney/)
 * (@daltonrooney)
 * [19 years, 5 months ago](https://wordpress.org/support/topic/sql-syntax-error-on-missing-post/)
 * I recently cleaned up my blog and deleted a whole bunch of posts. Normally, when
   people follow links to deleted posts, people get a 404 page. Now, for some reason,
   I get an SQL syntax error instead:
 * `
    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 'ORDER BY post_date ASC LIMIT 1' at line 1] SELECT ID,post_title FROM
   wp_posts WHERE post_date > '' AND post_date < '2007-01-03 08:25:43' AND post_status
   = 'publish' AND ID != ORDER BY post_date ASC LIMIT 1
 * I can’t think of any plugins recently added that would cause this to happen. 
   Does anyone have any recommendations for troubleshooting?
 * Thanks,
    Dalton
 * edit: I should have thought to add an example URL:
    [http://www.seriouslyexcited.net/?p=101](http://www.seriouslyexcited.net/?p=101)
 * In the past, this would have led to a 404.

Viewing 1 replies (of 1 total)

 *  Thread Starter [Dalton Rooney](https://wordpress.org/support/users/daltonrooney/)
 * (@daltonrooney)
 * [19 years, 5 months ago](https://wordpress.org/support/topic/sql-syntax-error-on-missing-post/#post-497789)
 * *crickets*

Viewing 1 replies (of 1 total)

The topic ‘SQL Syntax error on missing post’ 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/)
 * 1 reply
 * 1 participant
 * Last reply from: [Dalton Rooney](https://wordpress.org/support/users/daltonrooney/)
 * Last activity: [19 years, 5 months ago](https://wordpress.org/support/topic/sql-syntax-error-on-missing-post/#post-497789)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
