with cte1 as( select Posts.Id, Posts.OwnerUserId, Posts.O...

0

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

with cte1 as(
select 
      Posts.Id,
      Posts.OwnerUserId,
      Posts.OwnerDisplayName,
      Posts.Title,
      Posts.Body,
      Posts.CreationDate,
      Posts.AcceptedAnswerId
from Posts 
where ParentId is null and AcceptedAnswerId is not null),

cte2 as(
select 
      Posts.Id,
      Posts.OwnerUserId,
      Posts.OwnerDisplayName,
      Posts.Body,
      Posts.CreationDate,
      Posts.AcceptedAnswerId 
from Posts
where ParentId is not null)

select top 10
      --cte1.Id,
      cte1.OwnerUserId,
      cte1.OwnerDisplayName,
      cte1.Title,
      cte1.body,
      cte1.CreationDate,
      --cte2.Id,
      --cte2.OwnerUserId,
      cte2.OwnerDisplayName,
      cte2.Body,
      cte2.CreationDate
from cte1 inner join cte2 on cte1.AcceptedAnswerId=cte2.Id
where DATEDIFF(MINUTE, cte1.creationdate , cte2.creationdate)>=15;

Enter Parameters

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