mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-12 23:14:18 +01:00
#615 Fixed bug on multi column queries - wrong count resulting in strange effects in the display of results
SVN:trunk[2422]
This commit is contained in:
@@ -311,8 +311,13 @@ class SQLQuery
|
||||
{
|
||||
if (count($aSelectedIdFields) > 0)
|
||||
{
|
||||
$sIDFields = implode(', ', $aSelectedIdFields);
|
||||
$sSQL = "SELECT COUNT(DISTINCT $sIDFields) AS COUNT FROM $sFrom WHERE $sWhere";
|
||||
$aCountFields = array();
|
||||
foreach ($aSelectedIdFields as $sFieldExpr)
|
||||
{
|
||||
$aCountFields[] = "COALESCE($sFieldExpr, 0)"; // Null values are excluded from the count
|
||||
}
|
||||
$sCountFields = implode(', ', $aCountFields);
|
||||
$sSQL = "SELECT COUNT(DISTINCT $sCountFields) AS COUNT FROM $sFrom WHERE $sWhere";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user