mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +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)
|
if (count($aSelectedIdFields) > 0)
|
||||||
{
|
{
|
||||||
$sIDFields = implode(', ', $aSelectedIdFields);
|
$aCountFields = array();
|
||||||
$sSQL = "SELECT COUNT(DISTINCT $sIDFields) AS COUNT FROM $sFrom WHERE $sWhere";
|
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
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user