Average response time by tags

0

Please login or register to vote for this query.

(click on this box to dismiss)

The average response time for most popular tags (with at least one vote)

Constructed Languages Meta

Q&A about the site for designers and users of artificial or invented languages, consciously developed instead of having developed naturally

-- Average response time by tags
-- The average response time for most popular tags (with at least one vote)

declare @limit int = 100;
declare @tag_name nvarchar(35) = 'snowflake-cloud-data-platform';
declare @tag_id int = (select id from tags where tagname = @tag_name);
with post_comments as
(
select
  postid
  , min(creationdate) as first_comment
from comments
group by postid
)
select
  count(distinct posts.id) as posts_with_comments
  , avg(datediff(hour, posts.CreationDate, post_comments.first_comment)) as average_response_time_in_hours
from posts
inner join post_comments
  on posts.id = post_comments.postid
where
  posts.CreationDate BETWEEN '2021-05-03' AND '2021-05-10'

Enter Parameters

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