Spellcheck for Tag Except / Wiki


Please login or register to vote for this query.

(click on this box to dismiss)


Q&A for community managers, administrators, and moderators

SELECT a.TagName, a.Excerpt, a.Wiki
    FROM (
        SELECT c.TagName, c.CountPosts, e.Body AS 'Excerpt', w.Body AS 'Wiki'
            FROM (
                SELECT t.TagName, t.ExcerptPostId, t.WikiPostId,
                       COUNT(*) AS CountPosts
                    FROM Tags t
                         LEFT OUTER JOIN TagSynonyms s ON (t.TagName = s.SourceTagName)
                         INNER JOIN PostTags p ON (p.TagId = t.Id)
                    WHERE s.ApprovalDate IS NULL
                    GROUP BY t.TagName, t.ExcerptPostId, t.WikiPostId
                ) c
                LEFT OUTER JOIN Posts e ON (c.ExcerptPostId = e.Id)
                LEFT OUTER JOIN Posts w ON (c.WikiPostId = w.Id)
            (c.ExcerptPostId IS NOT NULL AND LEN(LTRIM(RTRIM(e.Body))) > 0)
            (c.WikiPostId IS NOT NULL AND LEN(LTRIM(RTRIM(w.Body))) > 0)
        ) a
    ORDER BY a.CountPosts DESC, a.TagName ASC

Enter Parameters

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