Number of users interested in either of the two tags and in both of them

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

declare @ExcelVbaUsers as table (Id int primary key)
declare @WordVbaUsers as table (Id int primary key)

insert into @ExcelVbaUsers
select Users.Id
from (
select count(*) as Nq, OwnerUserId from
Posts
join PostTags on Posts.Id = PostTags.PostId
join Tags on PostTags.TagId = Tags.Id
where Tags.TagName = 'excel-vba'
group by OwnerUserId
) as Vba
join Users on Vba.OwnerUserId = Users.Id
where Vba.Nq >= 5

insert into @WordVbaUsers
select Users.Id
from (
select count(*) as Nq, OwnerUserId from
Posts
join PostTags on Posts.Id = PostTags.PostId
join Tags on PostTags.TagId = Tags.Id
where Tags.TagName = 'word-vba'
group by OwnerUserId
) as Vba
join Users on Vba.OwnerUserId = Users.Id
where Vba.Nq >= 5

Enter Parameters

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