From 16b1d30b29c89b775aa4f8f2a31c4632a173de00 Mon Sep 17 00:00:00 2001 From: "Michael J. Rubinsky" Date: Fri, 14 Aug 2009 13:12:03 -0400 Subject: [PATCH] need the count field in the GROUP BY as well...wonder if it would be more efficient to do this as a DISTINCT query instead... --- content/lib/Tagger.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/lib/Tagger.php b/content/lib/Tagger.php index c83bac326..e034f6b9b 100644 --- a/content/lib/Tagger.php +++ b/content/lib/Tagger.php @@ -292,7 +292,7 @@ class Content_Tagger $sql = 'SELECT t.tag_id AS tag_id, tag_name, COUNT(*) AS count FROM ' . $this->_t('tagged') . ' AS tagged INNER JOIN ' . $this->_t('objects') . ' AS objects ON tagged.object_id = objects.object_id AND objects.type_id = ' . (int)$args['typeId'] . ' INNER JOIN ' . $this->_t('tags') . ' AS t ON tagged.tag_id = t.tag_id WHERE tagged.user_id = ' . (int)$args['user_id'] . ' GROUP BY t.tag_id'; } elseif (isset($args['userId'])) { $args['userId'] = current($this->_userManager->ensureUsers($args['userId'])); - $sql = 'SELECT t.tag_id AS tag_id, tag_name, count FROM ' . $this->_t('tagged') . ' AS tagged INNER JOIN ' . $this->_t('tags') . ' AS t ON tagged.tag_id = t.tag_id INNER JOIN ' . $this->_t('user_tag_stats') . ' AS uts ON t.tag_id = uts.tag_id AND uts.user_id = ' . (int)$args['userId'] . ' GROUP BY t.tag_id, tag_name'; + $sql = 'SELECT t.tag_id AS tag_id, tag_name, count FROM ' . $this->_t('tagged') . ' AS tagged INNER JOIN ' . $this->_t('tags') . ' AS t ON tagged.tag_id = t.tag_id INNER JOIN ' . $this->_t('user_tag_stats') . ' AS uts ON t.tag_id = uts.tag_id AND uts.user_id = ' . (int)$args['userId'] . ' GROUP BY t.tag_id, tag_name, count'; } elseif (isset($args['typeId'])) { $args['typeId'] = current($this->_typeManager->ensureTypes($args['typeId'])); // This doesn't use a stat table, so may be slow. -- 2.11.0