All hot questions networkwide for a given date


Please login or register to vote for this query.

(click on this box to dismiss) per site query based on from user Glorfindel:

Stack Overflow

Q&A for professional and enthusiast programmers

declare @sql nvarchar(max)

create table #result (site sysname
                    , hostname sysname
                    , postid integer
                    , title nvarchar(250)
                    , score int
                    , answercount int
                    , creationdate datetime
                    , hot datetime
                    , cool datetime)

-- per site query based on
-- from user Glorfindel:
select @sql = N'insert into #result' + STRING_AGG(concat(N'
select ''', name ,N''' as site
     , ''',hostname ,N'''
     , ps.postid 
     , p.title
     , p.score
     , p.answercount
     , p.creationdate
     , ps.creationdate as [hot]
     , coalesce(pe.creationdate, dateadd(d,4, ps.creationdate)) [cool]
from ', quotename(name), N'.dbo.posthistory ps
inner join ', quotename(name), N'.dbo.posts p on = ps.postid
left outer join ', quotename(name), N'.dbo.posthistory pe 
             on pe.postid = ps.postid 
            and pe.posthistorytypeid = 53
where ps.posthistorytypeid = 52 -- become hot
union all')
from (select convert(nvarchar(max),name) name
    -- , convert(nvarchar(max),sitename)  sitename
    -- , meta
    -- , domain
     ,  concat( 
        -- based on an idea from Glorfindel 
        (case sitename
        WHEN 'Audio' THEN 'video'
        WHEN 'Beer' THEN 'alcohol'
        WHEN 'CogSci' THEN 'psychology'
        WHEN 'Garage' THEN 'mechanics'
        WHEN 'Health' THEN 'medicalsciences'
        WHEN 'Moderators' THEN 'communitybuilding'
        WHEN 'Photography' THEN 'photo'
        WHEN 'Programmers' THEN 'softwareengineering'
        WHEN 'Vegetarian' THEN 'vegetarianism'
        WHEN 'Writers' THEN 'writing'
        WHEN 'Br' THEN 'pt'
        WHEN 'Mathoverflow' THEN concat((meta+'.'), sitename)
        ELSE case when sitename = domain then null else sitename end
        end +'.')
        , (case 
           when sitename <> 'mathoverflow' then (meta+'.') 
           else null 
        , (case 
           when sitename <> 'mathoverflow' then concat((domain + '.'), 'com') 
           else 'net' 
        ) hostname
from (
select name
, case parsename(name,1) 
  when 'Meta' then parsename(name,2)
  else parsename(name,1) 
  end [sitename]
, case parsename(name,1) 
  when 'Meta' then 'meta'
  else null
  end [meta]
  , coalesce(parsename(name,3), parsename(name,2)) [domain]
from sys.databases
where database_id > 5
and (name not like '%.Meta' or name = 'StackExchange.Meta')
and name not like '%_Temp'
) dbs
) dbsall

exec (@sql)

-- ((# of upvotes on Question)*(# of answer)/5 + (# of upvotes on Answer))/(# of hours )^1.4
select rank() over (order by power(((score * answercount)/5.0) / (convert(decimal,datediff(hh,creationdate, ##hotdate##))+1),1.4) desc)
, power(((score * answercount)/5.0) / (datediff(hh,creationdate, ##hotdate##)+1),1.4) [Est. disp score]
     , site
     , concat(
       , hostname
       , '/q/'
       , postid
       , '|'
       , title ) [Post] 
     , creationdate
     , hot
     , cool
from #result
where ##hotdate:string?2020-08-31## between [hot] and [cool]
order by power(((score * answercount)/5.0) / (datediff(hh,creationdate, ##hotdate##)+1),1.4) desc

Enter Parameters

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