@Martin yeah, it is a bit tricky. You probably need to get the top x users first in the #results table and then do the group by and having. Doing the CTE in the per-site query will probably not work due to how that query gets executed and the limitations on where and how CTE's are allowed.