[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.
[DBClientJoinBuilder][HostResourceQueryOption] Remove a needless space in SQL statement
[DBClientJoinBuilder] Don't add needless space to "FROM" clause
[testDBClientJoinBuilder] Fix a broken test
Merge pull request #565 from project-hatohol/issue-561-hack

Fix a bug that hostgroup filter doesn't work for events