Title: SQL Syntax Error
Last modified: August 22, 2016

---

# SQL Syntax Error

 *  [sgridley](https://wordpress.org/support/users/sgridley/)
 * (@sgridley)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/sql-syntax-error-9/)
 * I get the error below in my WP error log. It seems to refer to the NextGEN plugin,
   but I could be wrong since I am not a programmer.
 * Can you shed any light on this error and how to fix it?
 * [10-Aug-2014 07:00:22 UTC] 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 ‘-20, 20’ at line 1 for query SELECT DISTINCT wp_ngg_pictures.*,
   GROUP_CONCAT(CONCAT_WS(‘@@’, meta_key, meta_value)) AS ‘extras’ FROM `wp_ngg_pictures`
   LEFT OUTER JOIN `wp_postmeta` ON `wp_postmeta`.`post_id` = `extras_post_id` WHERE(`
   exclude` = 0) AND (`galleryid` IN (4)) GROUP BY wp_ngg_pictures.pid ORDER BY 
   ABS(`sortorder`) ASC, `sortorder` ASC LIMIT -20, 20 made by require(‘wp-blog-
   header.php’), require_once(‘wp-includes/template-loader.php’), include(‘/themes/
   cruel_intentions/page.php’), the_content, apply_filters(‘the_content’), call_user_func_array,
   C_NextGen_Shortcode_Manager->parse_content, do_shortcode, preg_replace_callback,
   do_shortcode_tag, call_user_func, M_NextGen_Basic_Gallery->render,
 * Thanks!
    Sam
 * [https://wordpress.org/plugins/nextgen-gallery/](https://wordpress.org/plugins/nextgen-gallery/)

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

 *  Thread Starter [sgridley](https://wordpress.org/support/users/sgridley/)
 * (@sgridley)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/sql-syntax-error-9/#post-5182384)
 * Sorry, forgot to include my MYSQL Version : 5.5.37-35.1
 *  Plugin Contributor [photocrati](https://wordpress.org/support/users/photocrati/)
 * (@photocrati)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/sql-syntax-error-9/#post-5182477)
 * [@sgridley](https://wordpress.org/support/users/sgridley/) – What version of 
   NextGEN Gallery are you using? Do you recall what actions you may have been taking
   near that error_log timestamp as a reference?
 * Thanks!
 * – Cais.

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

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

 * ![](https://ps.w.org/nextgen-gallery/assets/icon-256x256.png?rev=2083961)
 * [Photo Gallery, Sliders, Proofing and Themes - NextGEN Gallery](https://wordpress.org/plugins/nextgen-gallery/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/nextgen-gallery/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/nextgen-gallery/)
 * [Active Topics](https://wordpress.org/support/plugin/nextgen-gallery/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/nextgen-gallery/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/nextgen-gallery/reviews/)

## Tags

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

 * 2 replies
 * 2 participants
 * Last reply from: [photocrati](https://wordpress.org/support/users/photocrati/)
 * Last activity: [11 years, 9 months ago](https://wordpress.org/support/topic/sql-syntax-error-9/#post-5182477)
 * Status: not resolved