Tags Without Excerpt or Wiki (unbalanced)


Please login or register to vote for this query.

(click on this box to dismiss)

Amateur Radio

Q&A for amateur radio enthusiasts

SELECT c.TagName,
       c.CountPosts AS 'Number of Posts',
       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)
        WHERE (LEN(LTRIM(RTRIM(e.Body))) != 0 AND LEN(LTRIM(RTRIM(w.Body))) = 0)
           OR (LEN(LTRIM(RTRIM(e.Body))) = 0 AND LEN(LTRIM(RTRIM(w.Body))) != 0)
  ORDER BY c.CountPosts DESC, c.TagName ASC

Enter Parameters

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