显示我的计数结果

时间:2011-07-21 00:56:09

标签: php sql

我已经查询了一下,有多少人投了一个条目,它是这样的:

  $query = "SELECT itemid, COUNT(*) totalcount
FROM jos_sobi2_plugin_reviews
GROUP BY itemid
HAVING COUNT(*) > 1
ORDER BY COUNT(*) DESC
";

sql工作并生成下表。

entry id      totalcount
--------      ----------
202             5
203             20
204             15
...

我只想显示列totalcount而我没有成功。

也许有人知道我应该在我的php上查询哪个查询?

谢谢,罗恩!

1 个答案:

答案 0 :(得分:0)

$query = "SELECT COUNT(1) totalcount
FROM jos_sobi2_plugin_reviews
GROUP BY itemid
HAVING COUNT(1) > 1
ORDER BY COUNT(1) DESC
";

这可以正常工作