diff --git a/phpgwapi/inc/class.egw_db.inc.php b/phpgwapi/inc/class.egw_db.inc.php index 1af9bb743f..2fa8823ce5 100644 --- a/phpgwapi/inc/class.egw_db.inc.php +++ b/phpgwapi/inc/class.egw_db.inc.php @@ -2067,7 +2067,7 @@ class egw_db $select['table_def'], )); } - $sql = count($sql) > 1 ? '(' . implode(")\nUNION\n(",$sql).')' : $sql[0]; + $sql = count($sql) > 1 ? '(' . implode(")\nUNION\n(",$sql).')' : 'SELECT DISTINCT'.substr($sql[0],6); if ($order_by) $sql .= (!stristr($order_by,'ORDER BY') ? "\nORDER BY " : '').$order_by;