short tag names that exist both with and without a final S

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
  t1.Count AS [Count 1],
  'site://tags/' + t1.TagName + '|' + t1.TagName AS [Tag 1],
  t2.Count AS [Count 2],
  'site://tags/' + t2.TagName + '|' + t2.TagName AS [Tag 2]
FROM Tags t1, Tags t2
WHERE
  t2.TagName = t1.TagName + 's' AND
  Len(t1.TagName) <= 3
ORDER BY CASE WHEN t2.Count > t1.Count THEN t2.Count ELSE t1.Count END DESC,
         CASE WHEN t2.Count > t1.Count THEN t1.Count ELSE t2.Count END DESC,
         t1.TagName ASC

Enter Parameters

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