Calculate amount of mugs to give away so I'll receive one

0

Please login or register to vote for this query.

(click on this box to dismiss)

Code Review

Q&A for peer programmer code reviews

DECLARE @mugs INT,@rounded_mugs INT,@inc INT,@remainder INT;
SELECT  @mugs = COUNT(1) FROM Users WHERE Reputation >= 
  (SELECT Reputation FROM Users WHERE DisplayName=##Username:string##);
SET  @remainder = @mugs%50;
IF (@remainder = 0) SET @inc = 0 ELSE SET @inc=50-@remainder; 
SELECT  @mugs+@inc AS 'Amount of mugs to give away';

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results