Steps to reproduce the issue
- Go to Components -> Articles
- Click on the ordering filter on the right and select "Sort Tables By:"

- The following SQL error appears:
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 20' at line 11 SQL=SELECT a.id, a.title, a.alias, a.checked_out, a.checked_out_time, a.catid, a.state, a.access, a.created, a.created_by, a.created_by_alias, a.ordering, a.featured, a.language, a.hits, a.publish_up, a.publish_down,l.title AS language_title, l.image AS language_image,uc.name AS editor,ag.title AS access_level,c.title AS category_title,ua.name AS author_name,COALESCE(NULLIF(ROUND(v.rating_sum / v.rating_count, 0), 0), 0) AS rating, COALESCE(NULLIF(v.rating_count, 0), 0) as rating_count FROM jos_content AS a LEFT JOIN `jos_languages` AS l ON l.lang_code = a.language LEFT JOIN jos_users AS uc ON uc.id=a.checked_out LEFT JOIN jos_viewlevels AS ag ON ag.id = a.access LEFT JOIN jos_categories AS c ON c.id = a.catid LEFT JOIN jos_users AS ua ON ua.id = a.created_by LEFT JOIN jos_content_rating AS v ON a.id = v.content_id WHERE (a.state = 0 OR a.state = 1) ORDER BY LIMIT 20
Expected result
The default value is used for filtering instead of a empty string. (See the view "Featured Articles" for example)
System information (as much as possible)
- Latest version of Joomla! Staging
- PHP 5.6.34
Additional comments
This error has something to do with this if statement: https://github.com/joomla/joomla-cms/blob/staging/administrator/components/com_content/models/articles.php#L327
Confirmed on current staging
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/13114.