Posts and answers datadump

0

Please login or register to vote for this query.

(click on this box to dismiss)

Engineering

Q&A for professionals and students of engineering

SET NOCOUNT ON 

DECLARE @Question 
TABLE (
  Id int, 
  PostTypeId tinyint,
  ParentId int,
  Body nvarchar(max), 
  Title nvarchar(250),
  Tags nvarchar(250),
  CreationDate datetime
)

DECLARE @Answer 
TABLE (
  Id int, 
  PostTypeId tinyint,
  ParentId int,
  Body nvarchar(max), 
  Title nvarchar(250),
  Tags nvarchar(250),
  CreationDate datetime
)

INSERT @Question
SELECT
  TOP 5
  Id,
  PostTypeId,
  ParentId,
  Body,
  Title,
  Tags,
  CreationDate
FROM Posts
WHERE 
  tags like '%<##tag?python##>%' and 
  PostTypeId = 1 and
  CreationDate >= '2020-01-01 00:00:000' and
  CreationDate < '2020-02-01 00:00:000'

INSERT @Answer
SELECT
  p.Id,
  p.PostTypeId,
  p.ParentId,
  p.Body,
  p.Title,
  p.Tags,
  p.CreationDate
FROM Posts p, @Question q
WHERE p.PostTypeId = 2 and p.ParentId = q.Id

SET NOCOUNT OFF

SELECT p.*
FROM (
  SELECT *
  FROM @Question
  UNION SELECT *
  FROM @Answer
) AS p

Enter Parameters

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