Q&A for experienced flyers, pilots, and builders of drones and model aircraft
select usertag.userid as userid, max(sumtag.tagbreadth) as tagbreadth, max(sumtag.avgtagcount) as avgtagcount, sum(square(cast(usertag.tag_count as numeric)/ cast(sumtag.tag_total as numeric))) as tagdepth, sumtag.month as month from (select UserList.uid as userid, count(pt.TagId) as tag_count, pt.TagId as tagid, datediff(month,cast('2015-03-01' as datetime), p.CreationDate) as month from Tags t, Posts p, PostTags pt, (select p.OwnerUserId as uid from Posts p, PostTags pt, Users u where p.OwnerUserId=u.Id and p.Id=pt.PostId and (pt.TagId=1871) and p.PostTypeid=1 and p.CreationDate>=cast('2015-03-01' as datetime) and p.CreationDate<=cast('2017-03-31' as datetime) group by p.OwnerUserId ) UserList where UserList.uid=p.OwnerUserId and p.PostTypeid=1 and pt.PostId = p.Id and pt.TagId = t.Id /*pt.*/ and p.CreationDate>=cast('2015-03-01' as datetime) and p.CreationDate<=cast('2017-03-31' as datetime) and (pt.TagId=1871) group by UserList.uid, pt.TagId, datediff(month,cast('2015-03-01' as datetime), p.CreationDate) ) usertag, (select UserList.uid as userid, count(distinct(pt.TagId)) as tagbreadth, cast(count(pt.TagId)as numeric)/count(distinct(p.Id)) as avgtagcount, count(pt.TagId) as tag_total, datediff(month,cast('2015-03-01' as datetime), p.CreationDate) as month from Tags t, Posts p, PostTags pt, (select p.OwnerUserId as uid from Posts p, PostTags pt, Users u where p.OwnerUserId=u.Id and p.Id=pt.PostId and (pt.TagId=1871) and p.PostTypeid=1 and p.CreationDate>=cast('2015-03-01' as datetime) and p.CreationDate<=cast('2017-03-31' as datetime) group by p.OwnerUserId ) UserList where UserList.uid=p.OwnerUserId and p.PostTypeid=1 and pt.PostId = p.Id and pt.TagId = t.Id and p.CreationDate>=cast('2015-03-01' as datetime) and p.CreationDate<=cast('2017-03-31' as datetime) and (pt.TagId=1871) group by UserList.uid, datediff(month,cast('2015-03-01' as datetime), p.CreationDate) ) sumtag where sumtag.userid = usertag.userid and usertag.tag_count > 0 and sumtag.tag_total > 0 and usertag.month = sumtag.month group by usertag.userid , sumtag.month