From 9d6f20ccf1cf5572647be0c7a1c88401a239c3a4 Mon Sep 17 00:00:00 2001 From: laf Date: Tue, 5 May 2015 23:54:36 +0100 Subject: [PATCH] Another tweak to SQL query for devices --- html/includes/table/devices.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/html/includes/table/devices.inc.php b/html/includes/table/devices.inc.php index 68a29e20dd..d1f572e162 100644 --- a/html/includes/table/devices.inc.php +++ b/html/includes/table/devices.inc.php @@ -37,7 +37,7 @@ if (!empty($_POST['disabled'])) { $sql .= " AND disabled= ?"; $param[] = $_P if (!empty($_POST['ignore'])) { $sql .= " AND `ignore`= ?"; $param[] = $_POST['ignore']; } if (!empty($_POST['location']) && $_POST['location'] == "Unset") { $location_filter = ''; } if (!empty($_POST['location'])) { - $sql .= " AND (((`DA`.`attrib_type`='override_sysLocation_string' AND `DA`.`attrib_value` = ?)) OR `location` = ?)"; + $sql .= " AND (((`DB`.`attrib_value`='1' AND `DA`.`attrib_type`='override_sysLocation_string' AND `DA`.`attrib_value` = ?)) OR `location` = ?)"; $param = array(mres($_POST['location']),mres($_POST['location'])); } if( !empty($_POST['group']) ) { @@ -73,7 +73,7 @@ if ($rowCount != -1) { $sql .= " LIMIT $limit_low,$limit_high"; } -$sql = "SELECT `devices`.* $sql"; +$sql = "SELECT DISTINCT(`devices`.`device_id`),`devices`.* $sql"; if (!isset($_POST['format'])) { $_POST['format'] = "list_detail";