Question 2 Response

0

Please login or register to vote for this query.

(click on this box to dismiss)

Craft CMS Meta

Q&A about the site for administrators, end users, developers and designers for Craft CMS

select top 10 u.id, (count(p.owneruserid) + count(c.userid)) as total
from users u
left join posts p on u.id = p.owneruserid
left join comments c on u.id = c.userid
where (datediff(year, current_timestamp, p.creationdate) <= 5
or datediff(year, current_timestamp, c.creationdate) <= 5)
group by u.id, p.owneruserid, c.userid
order by total desc

Enter Parameters

Options:
Switch to main site
loading Hold tight while we fetch your results