My Questions by Views

1

Please login or register to vote for this query.

(click on this box to dismiss)

Shows which of a given user's questions have the most views.

Poker Meta

Q&A about the site for serious players and enthusiasts of poker

DECLARE @UserId int = ##UserId##
CREATE TABLE #MyQuestions (
  Id int,
  Title nvarchar(250),
  ViewCount int,
  ViewCountGroup int,
  CreationDate datetime
)
INSERT INTO #MyQuestions
  SELECT Id, Title, ViewCount,
         FLOOR(EXP(FLOOR(LOG(ViewCount)))) as ViewCountGroup, CreationDate
  FROM Posts p
  WHERE p.PostTypeId = 1
  AND p.OwnerUserId = @UserId

SELECT Title, ViewCount
FROM #MyQuestions
GROUP BY Title, ViewCount
ORDER BY ViewCount DESC

Enter Parameters

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