Title: WordPress database error
Last modified: May 6, 2021

---

# WordPress database error

 *  Resolved [nerodigital](https://wordpress.org/support/users/nerodigital/)
 * (@nerodigital)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/wordpress-database-error-159/)
 * Hi, we’ve only recently installed TEC and started working on it by adding a couple
   of test events but on the front-end (/events/ page) we get this sql error (debug
   mode)
 * 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‘
   LIMIT 0, 12’ at line 8]
    SELECT SQL_CALC_FOUND_ROWS wp_posts.ID, CAST( orderby_event_date_utc_meta.
   meta_value AS DATETIME ) AS event_date_utc FROM wp_posts LEFT JOIN wp_postmeta
   AS orderby_event_date_utc_meta ON ( orderby_event_date_utc_meta.post_id = wp_posts.
   ID AND orderby_event_date_utc_meta.meta_key = ‘_EventStartDateUTC’ ) WHERE 1=
   1 AND wp_posts.post_password != ” AND wp_posts.post_type = ‘tribe_events’ AND((
   wp_posts.post_status <> ‘trash’ AND wp_posts.post_status <> ‘auto-draft’)) GROUP
   BY wp_posts.ID ORDER BY event_date_utc ASC, LIMIT 0, 12
 * 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‘
   LIMIT 0, 13’ at line 19]
    SELECT wp_posts.ID, CAST( orderby_event_date_utc_meta.
   meta_value AS DATETIME ) AS event_date_utc, CAST( orderby_event_duration_meta.
   meta_value AS DECIMAL ) AS event_duration FROM wp_posts LEFT JOIN wp_postmeta
   ON (wp_posts.ID = wp_postmeta.post_id AND wp_postmeta.meta_key = ‘_EventHideFromUpcoming’)
   LEFT JOIN wp_postmeta AS mt1 ON ( wp_posts.ID = mt1.post_id ) LEFT JOIN wp_postmeta
   AS orderby_event_date_utc_meta ON ( orderby_event_date_utc_meta.post_id = wp_posts.
   ID AND orderby_event_date_utc_meta.meta_key = ‘_EventStartDateUTC’ ) LEFT JOIN
   wp_postmeta AS orderby_event_duration_meta ON ( orderby_event_duration_meta.post_id
   = wp_posts.ID AND orderby_event_duration_meta.meta_key = ‘_EventDuration’ ) WHERE
   1=1 AND ( wp_postmeta.post_id IS NULL AND ( mt1.meta_key = ‘_EventEndDateUTC’
   AND CAST(mt1.meta_value AS DATETIME) > ‘2021-05-06 15:52:11’ ) ) AND wp_posts.
   post_type = ‘tribe_events’ AND ((wp_posts.post_status = ‘publish’)) GROUP BY 
   wp_posts.ID ORDER BY event_date_utc ASC, event_duration ASC, LIMIT 0, 13
 * 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‘
   LIMIT 0, 12’ at line 10]
    SELECT SQL_CALC_FOUND_ROWS wp_posts.ID, CAST( orderby_event_date_utc_meta.
   meta_value AS DATETIME ) AS event_date_utc FROM wp_posts INNER JOIN wp_postmeta
   ON ( wp_posts.ID = wp_postmeta.post_id ) LEFT JOIN wp_postmeta AS orderby_event_date_utc_meta
   ON ( orderby_event_date_utc_meta.post_id = wp_posts.ID AND orderby_event_date_utc_meta.
   meta_key = ‘_EventStartDateUTC’ ) WHERE 1=1 AND ( ( wp_postmeta.meta_key = ‘_EventStartDateUTC’
   AND CAST(wp_postmeta.meta_value AS DATETIME) > ‘2021-05-05 23:00:00’ ) ) AND 
   wp_posts.post_type = ‘tribe_events’ AND ((wp_posts.post_status = ‘publish’)) 
   GROUP BY wp_posts.ID ORDER BY event_date_utc ASC, LIMIT 0, 12
 * 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‘
   LIMIT 0, 12’ at line 8]
    SELECT SQL_CALC_FOUND_ROWS wp_posts.ID, CAST( orderby_event_date_utc_meta.
   meta_value AS DATETIME ) AS event_date_utc FROM wp_posts LEFT JOIN wp_postmeta
   AS orderby_event_date_utc_meta ON ( orderby_event_date_utc_meta.post_id = wp_posts.
   ID AND orderby_event_date_utc_meta.meta_key = ‘_EventStartDateUTC’ ) WHERE 1=
   1 AND wp_posts.post_type = ‘tribe_events’ AND ((wp_posts.post_status = ‘publish’))
   GROUP BY wp_posts.ID ORDER BY event_date_utc ASC, LIMIT 0, 12`
 * We’re running TEC version 5.6.0 on WP version 5.7.1
 * Any ideas what might be causing the error?
 * TIA.

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

 *  [robelemental](https://wordpress.org/support/users/robelemental/)
 * (@robelemental)
 * [5 years ago](https://wordpress.org/support/topic/wordpress-database-error-159/#post-14652531)
 * Hi [@nerodigital](https://wordpress.org/support/users/nerodigital/)
    Thanks for
   reaching out and for your patience on this issue. Are you still experiencing 
   this database error?
 * If you are still having issues:
 * 1. Please start with our conflict test guide here: [https://theeventscalendar.com/knowledgebase/k/testing-for-conflicts/#look-for-solution](https://theeventscalendar.com/knowledgebase/k/testing-for-conflicts/#look-for-solution)
 * 2. Reply back with any screenshots or site URl we can review.
 * Thanks
    Rob
 *  Plugin Support [Deblyn Prado](https://wordpress.org/support/users/deblynprado/)
 * (@deblynprado)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/wordpress-database-error-159/#post-14825350)
 * Hello!
 * We haven’t received any feedback from you in a while so we’re closing this topic
   now.
 * If you still need assistance please feel free to open a new Thread.
 * Thank you!

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

The topic ‘WordPress database error’ is closed to new replies.

 * ![](https://ps.w.org/the-events-calendar/assets/icon-256x256.gif?rev=2516440)
 * [The Events Calendar](https://wordpress.org/plugins/the-events-calendar/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/the-events-calendar/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/the-events-calendar/)
 * [Active Topics](https://wordpress.org/support/plugin/the-events-calendar/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/the-events-calendar/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/the-events-calendar/reviews/)

 * 2 replies
 * 3 participants
 * Last reply from: [Deblyn Prado](https://wordpress.org/support/users/deblynprado/)
 * Last activity: [4 years, 10 months ago](https://wordpress.org/support/topic/wordpress-database-error-159/#post-14825350)
 * Status: resolved