4

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?

1 Answer 1

6

It turns out I wrote such a query four years ago. @rene and others taught me how to write cross-site database queries, which admittedly takes some advanced SQL skills, and this was one of my first ones.

enter image description here

Since you're new to SQL, I can highly recommend the SEDE tutorial written by @MonicaCellio.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.