WITH posts_with_total_2_tags AS ( SELECT TOP 100 PostId, ...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Software Recommendations

Q&A for people seeking specific software recommendations

WITH posts_with_total_2_tags AS
(
SELECT TOP 100 PostId, COUNT(TagId) as tag_count
FROM PostTags
GROUP BY PostId
HAVING COUNT(TagId) = 2
),
posts_with_total_2_tags_separated AS
(
SELECT 
*,
MIN(TagId) OVER (PARTITION BY PostId) as tag_min_id,
MAX(TagId) OVER (PARTITION BY PostId) as tag_max_id 
FROM PostTags
WHERE PostId in (SELECT PostId FROM posts_with_total_2_tags)
),
posts_with_total_2_tags_separated_grouped AS
(
SELECT PostId, tag_min_id, tag_max_id 
FROM posts_with_total_2_tags_separated
GROUP BY PostId, tag_min_id, tag_max_id
)
SELECT * FROM posts_with_total_2_tags_separated_grouped

Enter Parameters

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