.' ticket '.
' LEFT JOIN ost_department dept ON ticket.dept_id=dept.dept_id'. // gerald
'LEFT JOIN '.TICKET_TABLE.' open ON open.ticket_id=ticket.ticket_id AND open.status=\... gerald
$sql.='LEFT JOIN '.TICKET_TABLE.' answered ON answered.ticket_id=ticket.ticket_id AND answered.... red=1 '.
'LEFT JOIN '.TICKET_TABLE.' overdue ON overdue.ticket_id=ticket.ticket_id AND overdue.st