I want to know who are the top users across all sites in terms of number of sites in which they've got at least one famous question (so, count is across sites, not across famous questions).
I know nothing of SQL and have been essentially trying to copy/paste other queries to my needs. Have invested lots of time now and decided to ask here instead. My last attempt:
SELECT userId AS [User Link],
COUNT(CASE WHEN Name IN ('Famous Question') THEN 1 ELSE 0 END) AS "Famous"
FROM sys.databases
INNER JOIN Badges AS b
ON b.UserId = userId
WHERE b.Name = 'Famous Question'
ORDER BY "Famous" DESC
Code doesn't work, nor do I know how to correct it. No surprises there since I know nothing of SQL. Could someone help out please?
