create table #temp (ZAbs bigint, K int, KUMU bigint); go ...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Science Fiction and Fantasy Meta

Q&A about the site for science fiction and fantasy enthusiasts

create table #temp (ZAbs bigint, K int, KUMU bigint);
go

with FPQA as   --- first post Q answerers 
(select u.Id UID, u.CreationDate UCD, p1.Id FPID, p1.CreationDate FPCD , p2.ID FPAID
from Users u inner join Posts p1
on u.Id = p1.OwnerUserId
inner join Posts p2 on p2.ParentId = p1.Id
where p1.PostTypeId = 1
and p2.PostTypeId = 2
and p1.OwnerUserId = p2.OwnerUserId
and u.Creationdate >= '2019-01-01' and u.CreationDate < '2020-01-01'
) 
--select fpqa.UID UID, fpqa.UCD UCD, fpqa.FPID FPID, fpqa.FPCD FPCD, fpqa.FPAID, 
--p.Id SPID, p.CreationDate SPCD, datediff (mi, fpqa.FPCD, p.CreationDate)
insert into #temp 
select datediff (mi, fpqa.FPCD, p.CreationDate) ZAbs, count(*) K, (datediff (mi, fpqa.FPCD, p.CreationDate) * (count (*))) as KUMU
from FPQA fpqa inner join Posts p on fpqa.UID = p.OwnerUserId
where p.CreationDate > fpqa.FPCD and p.PostTypeId in (1,2)
group by datediff (mi, fpqa.FPCD, p.CreationDate) 
order by datediff (mi, fpqa.FPCD, p.CreationDate) 

select count (*) from #temp

select sum (KUMU) from #temp


--select * from #temp where 
--KUMU > -0.45 * (select max(KUMU) from #temp) and
--KUMU < 0.55 * (select max(KUMU) from #temp)

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results