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 select count(w.Id) as WordVbaUsers, count(e.Id) as ExcelVbaUsers, count(b.Id) as BothUsers from @ExcelVbaUsers e, @WordVbaUsers w, (select w.Id as Id from @ExcelVbaUsers e join @WordVbaUsers w on e.Id = w.Id) as b