My data

0

Please login or register to vote for this query.

(click on this box to dismiss)

Drupal Answers Meta

Q&A about the site for Drupal developers and administrators

-- SELECT * FROM Users WHERE Id = 11323371

-- SELECT TOP 3 * FROM Posts WHERE OwnerUserID = 11323371 ORDER BY Score DESC

-- SELECT TOP 3 * FROM Comments WHERE UserID = 11323371 ORDER BY Score DESC

WITH BadgeData AS (
    SELECT 
        b.*, 
        bc.BadgeCount,
        ROW_NUMBER() OVER (PARTITION BY b.Name ORDER BY bc.BadgeCount DESC) AS RowNum
    FROM 
        Badges b
    JOIN 
        (SELECT Name, COUNT(*) AS BadgeCount
         FROM Badges
         WHERE UserID = 11323371
         GROUP BY Name) bc
    ON 
        b.Name = bc.Name
    WHERE 
        b.UserID = 11323371
)
SELECT 
    *
FROM 
    BadgeData
WHERE 
    RowNum = 1
ORDER BY 
    BadgeCount DESC;

Enter Parameters

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