select usertag.userid as userid, count(distinct(usertag.t...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Android Enthusiasts

Q&A for enthusiasts and power users of the Android operating system

select usertag.userid as userid, count(distinct(usertag.tagid)) as tagbreadth, sum(square(cast(usertag.tag_count as numeric)/ cast(sumtag.tag_total as numeric))) as tagdepth
from
(select UserList.uid as userid,  count(pt.TagId) as tag_count, pt.TagId as tagid

from Tags t, PostsWithDeleted 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=19195) 
and p.PostTypeid=1
and p.CreationDate>=cast('2012-07-01' as datetime) 
and p.CreationDate<=cast('2015-03-01' 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)
group by UserList.uid, pt.TagId
) usertag,

(select UserList.uid as userid,  count(pt.TagId) as tag_total

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=19195) 
and p.PostTypeid=1
and p.CreationDate>=cast('2012-07-01' as datetime) 
and p.CreationDate<=cast('2015-03-01' 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('2012-07-01' as datetime) 
group by UserList.uid
) sumtag

where sumtag.userid = usertag.userid and usertag.tag_count > 0 and sumtag.tag_total > 0
group by usertag.userid

Enter Parameters

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