Number of XKCD links

0

Please login or register to vote for this query.

(click on this box to dismiss)

Christianity

Q&A for committed Christians, experts in Christianity and those interested in learning more

SELECT  link, COUNT(*)
FROM    (
        SELECT  'http' + SUBSTRING(start, 1, PATINDEX('%/%', SUBSTRING(start, 13, 30)) + 12)
        FROM    (
                SELECT  SUBSTRING(body, PATINDEX('%://xkcd.com/[0-9]%', body), 20) start
                FROM    (
                        SELECT  TOP 200000
                                body
                        FROM    posts
                        ORDER BY
                                id DESC
                        UNION
                        SELECT  TOP 1000000
                                text
                        FROM    comments
                        ORDER BY
                                id DESC
                        ) q
                WHERE   body LIKE '%://xkcd.com/[0-9]%'
                ) q
                ) q (link)
GROUP BY
        link

Enter Parameters

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