我做了如下的SQL查询:
SELECT ip ,count(*) AS count FROM Abfragen WHERE sid = 1 GROUP BY ip ORDER BY count DESC limit 10
结果是:
ip count
52.28.9.253 35046
213.128.143.1 3860
5.10.190.222 106
52.58.240.24 58
52.58.99.201 42
81.184.0.178 30
217.159.201.54 6
但我也想要结果的总记录数,例如7。
有人可以告诉我如何获得它吗?感谢。
答案 0 :(得分:1)
你可以像这样做
<强>更新强>
Select Count(*)
From (Select `ip`,count(*) as count
FROM (`Abfragen`
where `sid` = 1
Group BY `ip`
ORDER BY count DESC limit 10) AS IP_COUNT