13

I know how I can see my overall rank. But I find it is an injustice to compare myself with those who joined SO 4 to 5 years ago.
So I want to know my rank by comparing with only those who joined SO in same year when I joined (only rating after this year should be counted). Is there any way to find out or do I have to tolerate this injustice?

5
  • 6
    Anything's possible with SEDE. Jun 27, 2014 at 20:27
  • 11
    @Robert, blatant lies. SEDE cannot possibly make me outrank Jon Skeet. Jun 27, 2014 at 20:29
  • 1
    @FrédéricHamidi I am sure you can find something.
    – Sumurai8
    Jun 27, 2014 at 20:39
  • 4
    @FrédéricHamidi: Lies! Jun 27, 2014 at 21:49
  • 2
    @Jeroen, this violates the book. Something might happen. Jun 27, 2014 at 21:53

1 Answer 1

15

Been wanting to create an interesting query in SEDE, so I went ahead and created one here for this.

DECLARE @UserId INT = ##UserId##
DECLARE @Reputation INT
DECLARE @StartTime DATETIME

SELECT @Reputation = Reputation, @StartTime = CreationDate FROM Users 
WHERE Id = @UserID

SELECT 1 + COUNT(Id) AS Rank FROM Users WHERE Reputation > @Reputation 
AND DATEDIFF(YEAR, @StartTime, CreationDate) = 0

Testing it out, it gives me 12533 for you, so it seems you are ranked #12533 (and most likely in a tie).


By request in the comments, I made a separate query that gives you your rank as a percentile

DECLARE @UserId INT = ##UserId##
DECLARE @Reputation INT
DECLARE @Rank INT
DECLARE @Total INT
DECLARE @StartTime DATETIME

SELECT @Reputation = Reputation, @StartTime = CreationDate FROM Users 
WHERE Id = @UserID

SELECT @Rank = COUNT(Id) FROM Users WHERE Reputation < @Reputation 
AND DATEDIFF(YEAR, @StartTime, CreationDate) = 0

SELECT @Total = COUNT(Id) FROM Users 
WHERE DATEDIFF(YEAR, @StartTime, CreationDate) = 0

SELECT (@Rank * 100.0)/@Total

That gives me ~98.89 for you (in other words, you have more rep than 98.89% of users created in the same year as you).

However, if I tweak this slightly to ignore users with 1 rep, it drops to around ~96.2.

More seasoned Stack Overflow users may be more interested in the percentile when ignoring all users with less than 200 reputation, since that's the threshold to be shown in the reputation leagues. This drops you down all the way to 21.47, but it did ignore a lot of the users below you.


If you don't know what your user ID is, go to your Stack Overflow profile and look at the URL; it's the number before your display name. Using my profile URL as an example

http://stackoverflow.com/users/1476062/dennis-meng
                               ^^^^^^^

my ID would be 1476062.

15
  • Nice. Since I don't speak SQL: I figure putting "MONTH" or "DAY" on the last line instead of "YEAR" will do the expected thing? For example with "DAY", it would show my rank compared to everybody who joined on the same day or later? I like the result if that's the case. Jun 28, 2014 at 5:34
  • @RetoKoradi Not quite; if you only changed "YEAR" to "DAY" you get rank among those who joined on the same day, not same day or later. If you wanted same day or later, you'd also have to change the equals sign to a >= or <= (I think <=, but I'd have to play around a bit to be sure) Jun 28, 2014 at 5:38
  • Ah, yes, that makes sense now that I look at the expression more closely. It's probably >= for this purpose, based on my experiments. Jun 28, 2014 at 6:12
  • It wouldn't be too hard to check, just change 1 + COUNT(Id) to CreationDate and compare. (For what it's worth, I'm not really much of a SQL guy either; I know enough to play around but can't do anything close to fancy) Jun 28, 2014 at 6:15
  • I also don't know SQL, but if you're looking for improvements, I'd love to see a percentage rank, too! Jun 29, 2014 at 1:01
  • @user1118321 Yeah, I can do that. I'll post a link when I get to it. Jun 29, 2014 at 1:53
  • Always wanted this. Feeling good as I rank 55 :)
    – Amit Joki
    Jun 29, 2014 at 7:07
  • 6
    I'm 1338. Missed 1337 by one!
    – i3arnon
    Jun 29, 2014 at 7:37
  • @AmitJoki You might be interested in the list of users above you.
    – svick
    Jun 29, 2014 at 8:21
  • @svick good! But something is missing as the rank 1 holder had his account created 1 yr, 3 months before and mine was created 7 months before
    – Amit Joki
    Jun 29, 2014 at 8:25
  • @AmitJoki Both of those dates are in 2013, so I don't see the problem.
    – svick
    Jun 29, 2014 at 8:29
  • @svick but I think, in 8 months, I could've got a higher rank. Would be good if it was based on months instead of years.
    – Amit Joki
    Jun 29, 2014 at 8:32
  • Are you sure this is right? It gave me 151. I don't know whether to be proud or terrified Jun 29, 2014 at 8:54
  • @GabeSechan Well, given that you shoot up pretty fast and SEDE doesn't update very often (I think daily), I'd actually say that's a little low for you. I tried checking numbers with other queries; it's in the right ballpark, but getting an exact read on a fast moving target is hard :). Jun 29, 2014 at 17:42
  • @user1118321 There, added percentile as well. Enjoy! :) Jun 29, 2014 at 18:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .