Skip to content

Commit

Permalink
Ido\StatusQuery: join ALL latest comment
Browse files Browse the repository at this point in the history
And it was soooo fast :p

refs #7057
  • Loading branch information
Thomas-Gelf committed Sep 2, 2014
1 parent d8e71d3 commit a58b2aa
Showing 1 changed file with 4 additions and 3 deletions.
Expand Up @@ -515,9 +515,10 @@ protected function getLastCommentSubQuery($entryType, $fieldName)
$sub = '(SELECT'
. ' c.object_id,'
. " '[' || c.author_name || '] ' || c.comment_data AS $fieldName"
. ' FROM icinga_comments c'
. ' WHERE c.entry_type = ' . $entryType
. ' ORDER BY c.comment_id DESC LIMIT 1)';
. ' FROM icinga_comments c JOIN ('
. ' SELECT MAX(comment_id) AS comment_id, object_id FROM icinga_comments'
. ' WHERE entry_type = ' . $entryType . ' GROUP BY object_id'
. ' ) lc ON c.comment_id = lc.comment_id)';

return new Zend_Db_Expr($sub);
}
Expand Down

0 comments on commit a58b2aa

Please sign in to comment.