Improved XKCD Finder

0

Please login or register to vote for this query.

(click on this box to dismiss)

A better version (based heavily on http://data.stackexchange.com/serverfault/s/915/most-popular-xkcd-links)

Stack Overflow

Q&A for professional and enthusiast programmers

-- Improved XKCD Finder 
-- A better version
SELECT
  SUBSTRING(C.Text, 
    CHARINDEX('xkcd.com/', C.Text) + 9,
    3
  ) AS CommentComicNumber, 'http://xkcd.com/' + SUBSTRING(C.Text,CHARINDEX('xkcd.com/',C.Text) + 9,3),
  count(*) AS CommentCount
  
FROM Comments as C
WHERE C.Text like '%xkcd.com/%'
GROUP BY 
  SUBSTRING(C.Text,
    CHARINDEX('xkcd.com/', C.Text) + 9,
    3
  )
ORDER BY count(*) DESC;

Enter Parameters

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