-
Type: Bug Report
-
Status: Closed
-
Priority: Minor
-
Resolution: Fixed
-
Affects Version/s: 5.1.1
-
Fix Version/s: 5.1.2-B1
-
Component/s: Database
-
Labels:None
-
External issue URL:
-
Additional information:
-
Change Log Message:Fixes Count SQLs with DISTINCT in sub-query
-
External issue ID:938
-
Copy Issue Key:
-
Patch Instructions:
There is a bug in kDBList::getCountSQL method, which generates SQL for counting list totals.
It checks if there's DISTINCT in SQL and, if it's there, tries to replace it for COUNT(DISTINCT...) construction instead of simple COUNT.
Problem is that it checks for distinct in ANY place of query, but replaces it in beginning, so, if there's DISTINCT in subquery, it won't replace anything. So, count SQL will be equal to list SQL, and you will get first record's first field's value (according to kDBConnection::GetOne logic) as record count.
- mentioned in
-
Page Loading...