mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
Subquery needed for avoid duplicates
This commit is contained in:
parent
775942e0b6
commit
6bf82accad
@ -118,6 +118,7 @@ function tactical_get_data($id_user=false, $user_strict=false, $acltags, $return
|
|||||||
$user_groups_ids = implode(',', array_unique($user_group_children_ids));
|
$user_groups_ids = implode(',', array_unique($user_group_children_ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Subquery is needed for avoid possible duplicity in id_agente.
|
||||||
$sql_stats = sprintf(
|
$sql_stats = sprintf(
|
||||||
'SELECT tma.id_grupo, COUNT(tma.id_agente) AS agents_total,
|
'SELECT tma.id_grupo, COUNT(tma.id_agente) AS agents_total,
|
||||||
SUM(tma.total_count) AS monitors_total,
|
SUM(tma.total_count) AS monitors_total,
|
||||||
@ -128,10 +129,12 @@ function tactical_get_data($id_user=false, $user_strict=false, $acltags, $return
|
|||||||
SUM(tma.notinit_count) AS monitors_not_init,
|
SUM(tma.notinit_count) AS monitors_not_init,
|
||||||
SUM(tma.fired_count) AS alerts_fired
|
SUM(tma.fired_count) AS alerts_fired
|
||||||
FROM tmetaconsole_agent tma
|
FROM tmetaconsole_agent tma
|
||||||
LEFT JOIN tmetaconsole_agent_secondary_group tmasg
|
WHERE tma.disabled = 0
|
||||||
ON tma.id_agente = tmasg.id_agent
|
AND tma.id_agente IN (
|
||||||
WHERE tma.disabled = 0
|
SELECT DISTINCT tmag.id_agente FROM tmetaconsole_agent tmag
|
||||||
AND tma.id_grupo IN (%s) OR tmasg.id_group IN (%s)
|
LEFT JOIN tmetaconsole_agent_secondary_group tmasg
|
||||||
|
ON tmag.id_agente = tmasg.id_agent WHERE tmag.id_grupo IN (%s) OR tmasg.id_group IN (%s)
|
||||||
|
)
|
||||||
GROUP BY tma.id_grupo',
|
GROUP BY tma.id_grupo',
|
||||||
$user_groups_ids,
|
$user_groups_ids,
|
||||||
$user_groups_ids
|
$user_groups_ids
|
||||||
|
Loading…
x
Reference in New Issue
Block a user