Q&A for designers and implementers of computer programming languages
with tagscounts_cte AS ( SELECT q.Id AS qid, COUNT(t.Id) numtags FROM Posts q INNER JOIN PostTags pt ON q.Id=pt.PostId INNER JOIN Tags t ON t.id = pt.TagId GROUP BY q.Id ) SELECT TOP(##num?100##) qid AS [Post Link], numtags, q.Tags FROM tagscounts_cte tc INNER JOIN Posts q ON q.Id=tc.qid INNER JOIN PostTags pt ON q.Id=pt.PostId INNER JOIN Tags t ON t.id = pt.TagId WHERE (t.TagName=##tagName:string?geometry##) AND (numtags=##tagscount?5##)