[DBClientJoinBuilder][HostResourceQueryOption] Fix a bug that hostgroup ...

...filter doesn't work for events

There are two reasons:

* A wrong table is used on generating a column name at
  HostResourceQueryOption::getFromClauseWithHostgroup()
* Can't resolve triggers.host_id on joining map_hosts_hostgroups
  table because MySQL try to join it before triggers table:
  ERROR 1054 (42S22): Unknown column 'triggers.host_id' in 'on clause'

To resolve later one, I moved "JOIN" clause of map_hosts_hostgroups
to the last of "FROM" clause. But it just a quick hack. I think we
should refactor generating SQL query to resolve it formally.

issue #561