Selects a "page" of duplicate pairs of questions from StackOverflow posts.


Please login or register to vote for this query.

(click on this box to dismiss)

The Workplace Meta

Q&A about the site for members of the workforce navigating the professional setting

-- Selects a "page" of duplicate pairs of questions from StackOverflow posts.
-- This query is a slight modification of:
-- Usage:
-- will retrieve the first 40,000 records.
-- Then you can call again with PageNumber=2 to get the next 40,000 records.
-- When you run this query in the StackOverflow query page, it will
-- prompt you for the values of PageSize and PageNumber.

DECLARE @PageSize int = ##PageSize##
DECLARE @PageNumber int = ##PageNumber##

  op.Id OriginalPostId, 
  op.PostTypeId OriginalPostPostTypeId, 
  op.AcceptedAnswerId OriginalPostAcceptedAnswerId, 
  op.ParentId OriginalPostParentId, 
  op.CreationDate OriginalPostCreationDate, 
  op.DeletionDate OriginalPostDeletionDate, 
  op.Score OriginalPostScore, 
  op.ViewCount OriginalPostViewCount, 
  op.Body OriginalPostBody, 
  op.OwnerUserId OriginalPostOwnerUserId, 
  op.OwnerDisplayName OriginalPostOwnerDisplayName, 
  op.LastEditorUserId OriginalPostLastEditorUserId, 
  op.LastEditorDisplayName OriginalPostLastEditorDisplayName, 
  op.LastEditDate OriginalPostLastEditDate, 
  op.LastActivityDate OriginalPostLastActivityDate, 
  op.Title OriginalPostTitle, 
  op.Tags OriginalPostTags, 
  op.AnswerCount OriginalPostAnswerCount, 
  op.CommentCount OriginalPostCommentCount, 
  op.FavoriteCount OriginalPostFavoriteCount, 
  op.ClosedDate OriginalPostClosedDate, 
  op.CommunityOwnedDate OriginalPostCommunityOwnedDate, 

  dupl.Id DuplicatePostId, 
  dupl.PostTypeId DuplicatePostPostTypeId, 
  dupl.AcceptedAnswerId DuplicatePostAcceptedAnswerId, 
  dupl.ParentId DuplicatePostParentId, 
  dupl.CreationDate DuplicatePostCreationDate, 
  dupl.DeletionDate DuplicatePostDeletionDate, 
  dupl.Score DuplicatePostScore, 
  dupl.ViewCount DuplicatePostViewCount, 
  dupl.Body DuplicatePostBody, 
  dupl.OwnerUserId DuplicatePostOwnerUserId, 
  dupl.OwnerDisplayName DuplicatePostOwnerDisplayName, 
  dupl.LastEditorUserId DuplicatePostLastEditorUserId, 
  dupl.LastEditorDisplayName DuplicatePostLastEditorDisplayName, 
  dupl.LastEditDate DuplicatePostLastEditDate, 
  dupl.LastActivityDate DuplicatePostLastActivityDate, 
  dupl.Title DuplicatePostTitle, 
  dupl.Tags DuplicatePostTags, 
  dupl.AnswerCount DuplicatePostAnswerCount, 
  dupl.CommentCount DuplicatePostCommentCount, 
  dupl.FavoriteCount DuplicatePostFavoriteCount, 
  dupl.ClosedDate DuplicatePostClosedDate, 
  dupl.CommunityOwnedDate DuplicatePostCommunityOwnedDate

FROM posts op 
  JOIN postlinks pl ON = pl.relatedpostid
  JOIN posts dupl ON pl.postid =
  op.posttypeid = 1      -- Question post
  AND pl.linktypeid = 3  -- duplicate
  AND op.Tags like '%<javascript>%'
  OFFSET @PageSize * (@PageNumber - 1) ROWS

Enter Parameters

Switch sites:
loading Hold tight while we fetch your results