Q&A for students, researchers and practitioners of computer science
-- Get question posts for all specific tags which also contain Java as a tag. For specific tags, look at defined list. -- Create post id of questions for specific tags. CREATE TABLE #UPostS (Id int) insert #UPostS select distinct P.id FROM Posts P INNER JOIN PostTags T ON P.id = T.PostId WHERE P.posttypeid = 1 and T.tagid in (11549, 694, 28085, 3916, 10699, 1601, 61322, 26278, 53810, 37106, 18930, 15557, 18248, 37965, 42538, 23107, 71986, 74669, 33844, 45835, 113934, 127807, 55404, 22846, 111175, 109096, 99761, 21550, 73832, 46491, 29822, 127297, 43801, 30662, 127474) and P.id > ##StartPostId## and P.id < ##EndPostId## -- Create post id of questions for Java tag. CREATE TABLE #UPostJ (Id int) insert #UPostJ select distinct P.id FROM Posts P INNER JOIN PostTags T ON P.id = T.PostId WHERE P.posttypeid = 1 and T.tagid = 17 and P.id > ##StartPostId## and P.id < ##EndPostId## -- Get postid where specific tags contain Java as a tag as intersection. CREATE TABLE #UPostJS (Id int) insert #UPostJS select S.Id FROM #UPostS S INNER JOIN #UPostJ J ON S.Id = J.Id order by S.Id -- Get posts for these specific tags AND Java on the same posts select * FROM Posts P INNER JOIN #UPostJS J ON P.Id = J.Id order by P.Id