Edit file /data/SugarBean.php
the code to edit is near line 930
//Put the query into the final_query
$query = $subquery['select'] . " " . $subquery['from'] . " " . $subquery['where'];
if (!$first) {
$query = ' UNION ALL ( ' . $query . ' )';
$final_query_rows .= " UNION ALL ";
} else {
**//$query = '(' . $query . ')';** COMENT HERE
$first = false;
}