SELECT p2.id as [Post Link], p2.tags FROM posts p2 JOIN (...

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

SELECT p2.id as [Post Link], p2.tags 
  FROM posts p2 JOIN
(
 SELECT p.id
 FROM posts p
 INNER JOIN PostTags pt
   ON p.Id=pt.PostId
 INNER JOIN Tags t
   ON pt.TagId=t.Id
  WHERE p.posttypeid = 1  and t.tagname IN ('html', 'django')
  GROUP BY p.id
 HAVING COUNT(DISTINCT t.id) = 2
) p1 ON p2.id = p1.id;
-- 5789 ms

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results