Search all users that have the same badges as one particular user

0

Please login or register to vote for this query.

(click on this box to dismiss)

Cardano Meta

Q&A for users and developers of the Cardano cryptocurrency ecosystem

-- @PostId -> need to know id of post
DECLARE @UserId int = ##UserId##

SELECT DISTINCT u.id, u.DisplayName
FROM Users u
INNER JOIN Badges b ON u.Id = b.UserId
WHERE NOT EXISTS (
  SELECT 1
  FROM Users u2
  WHERE u2.Id = @UserId AND u2.Id NOT IN (
        SELECT b2.Id
        FROM Badges b2
        WHERE b2.UserId = u.Id
  )
)

Enter Parameters

Options:
Switch to main site
loading Hold tight while we fetch your results