如何获取此mySQL查询的COUNT?

时间:2016-04-01 13:05:31

标签: mysql

如何才能获得以下查询中的行数?

select
hash,page,timestamp, count(*) as total
from behaviour
group by hash,page
having total > 2 AND timestamp >= Now() - interval 5 minute

1 个答案:

答案 0 :(得分:1)

仅通过查询解决方案:

SELECT COUNT(*)
FROM (
select
hash,page,timestamp, count(*) as total
from behaviour
group by hash,page
having total > 2 AND timestamp >= Now() - interval 5 minute) AS t1