I have two tables: hosts and events. Every event has a hostid. I would like to find out how many hosts have at least three events – I have come up with the following:
SELECT COUNT(*) FROM hosts,events
WHERE hosts.id=events.host_id COUNT(hosts.id)>=3
But it gives me the error “Invalid use of group function”.
How can I solve that?
try this: