create view viewname
as
SELECT t1.EventID, t1., ..., COUNT(*) AS Key
FROM _Events AS t1 INNER JOIN
_EventToClient AS t2 ON t1.EventID = t2.EventID INNER JOIN
_Clients AS t3 ON t2.ClientID = t3.ClientID
WHERE (t3.ClientConnected = 1)
GROUP BY t1.EventID
then call tha view by
select * from viewname order by desc