Q&A about the site for Muslims, experts in Islam, and those interested in learning more about Islam
;with users_ranked as ( select RANK() OVER(ORDER BY u.Reputation DESC) AS rnk, NTile(100) OVER(ORDER BY u.Reputation DESC) AS prc, u.id AS uid, u.Reputation rep FROM Users u ) SELECT 'You', r.rnk AS [Rank], r.prc, r.uid AS [User Link], r.rep AS [Reputation] FROM users_ranked r WHERE r.uid = ##userid## UNION ALL SELECT 'Community', r.rnk AS [Rank], r.prc, r.uid AS [User Link], r.rep AS [Reputation] FROM users_ranked r ORDER BY 1 DESC, r.rep DESC