Q&A for linguists, etymologists, and serious English language enthusiasts
declare @startDate datetime = dateadd(d,0-##daysBack:int?30##,( select min(create_date) from sys.tables )) select p.id as qID, p.tags -- my comments --into #myTags from posts p left join comments c on c.postid=p.id left join posttags pt on isnull(p.parentid,p.id)=pt.postid where c.creationdate>=@startDate and c.userid=##UserID## --insert into #myTags select --my posts p.id as qID, p.tags from posts p left join posttags pt on isnull(parentid,id)=pt.postid where p.creationdate>=@startDate and p.owneruserid=##UserID## /*select top 10 -- MAX 10 TAGS userid, tagid, count(*) as actions into #myTopTags from #myTags group by userid, tagid having count(*)>=10 --min. 10+ interactions with the tag order by count(*) desc */