Displaying an article or list of articles
[Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Incorrect syntax near the keyword 'DISTINCT'.
PHP Built On: Linux 4.4.0-96-generic # 119-Ubuntu SMP Tue Sep 12 14:59:54 UTC 2017 x86_64
Database Version: 12.00.5207 (Microsoft SQL)
Database Driver on Linux: Microsoft Drivers for PHP for SQL Server
PHP Version: 7.0.22-0ubuntu0.16.04.1
Web Server: Apache/2.4.18 (Ubuntu)
WebServer to PHP Interface: fpm-fcgi
Joomla! Version: Joomla! 3.8.2-dev Development [ Amani ] 4-October-2017 14:00 GMT
Joomla! Platform Version: Joomla Platform 13.1.0 Stable [ Curiosity ] 24-Apr-2013 00:00 GMT
It appears the specific SQL that's causing this error is SELECT TOP 4 DISTINCT
. A quick Google search tells me that for MSSQL it should instead be SELECT DISTINCT TOP 4
. The full query generated by Joomla! is attached.
In the file \joomla\libraries\joomla\database\query\sqlsrv.php
, when a limit is required, the function processLimit()
replaces SELECT
with SELECT TOP
in the query. So if DISTINCT is in there, you get the above syntax error.
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-10-12 10:53:43 |
Closed_By | ⇒ | franz-wohlkoenig |
Closed_By | franz-wohlkoenig | ⇒ | joomla-cms-bot |
@mruivo This PR should to be tested.
Please test patch from #18315 and if it is OK then mark test as success at https://issues.joomla.org/tracker/joomla-cms/18313
Set to "closed" on behalf of @franz-wohlkoenig by The JTracker Application at issues.joomla.org/joomla-cms/18313