Maybe Correct and Final

0

Please login or register to vote for this query.

(click on this box to dismiss)

Physics

Q&A for active researchers, academics and students of physics

SELECT *
FROM (SELECT ROW_NUMBER() OVER(ORDER BY [Post Id]) AS RowNum, *
      FROM (
SELECT p.Id as [Post Id], 'https://stackoverflow.com/questions/' + CAST(p.Id AS nvarchar) AS [Post Link], p.OwnerUserId, 
'https://stackoverflow.com/users/' + CAST(p.OwnerUserId AS nvarchar) AS [User Link], p.PostTypeId, pt.name as [Post Type], 
p.AcceptedAnswerId, 'https://stackoverflow.com/questions/' + CAST(p.ParentId AS nvarchar) AS [Parent Link], 
p.creationDate as [Post Creation Date], p.DeletionDate, p.Score, p.ViewCount, p.Body, ph.Text, p.AnswerCount, p.CommentCount, 
p.ClosedDate, ph.PostHistoryTypeId, pht.Name AS [Post History Type], ph.creationDate as [Post History Creation Date],
u.Reputation,u.DisplayName,u.LastAccessDate,u.Location,u.AboutMe, u.creationDate as [User Creation Date], u.Views,
u.UpVotes,u.DownVotes,u.AccountID
FROM posts p
Join PostTypes pt
on p.PostTypeId = pt.id
JOIN users u
ON p.OwnerUserId = u.Id
JOIN PostHistory ph
ON p.Id = ph.PostId
JOIN PostHistoryTypes pht
ON ph.PostHistoryTypeId = pht.Id
WHERE u.CreationDate >= '2016-01-01 00:00:00' and (PostTypeId = 1 or PostTypeId = 2)
) as a 
) as alias
WHERE RowNum BETWEEN 0 AND 50

Enter Parameters

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