Most popular XKCD links

0

Please login or register to vote for this query.

(click on this box to dismiss)

List all the links to XKCD posts with counts of how many times that is linked (guessing that the most will be xkcd.com/386)

Vegetarianism

Q&A for those committed to a vegan or vegetarian lifestyle and anyone interested in learning more

-- Most popular XKCD links
-- List all the links to XKCD posts with counts of how many times that is linked
-- (guessing that the most will be xkcd.com/386)

WITH XKCDLinkComments AS (
  SELECT
    PostId,
    1 AS Type,
    SUBSTRING(Text,
      CHARINDEX('xkcd.com/', Text) + 9,
      3
    ) AS ComicNumber
  FROM Comments
  WHERE Text like '%xkcd.com/%'
  UNION ALL
  SELECT
    Id,
    2 AS Type,
    SUBSTRING(Body,
      CHARINDEX('xkcd.com/', Body) + 9,
      3
    ) AS ComicNumber
  FROM Posts
  WHERE Body like '%xkcd.com/%'
)

SELECT
  PostId AS [Post Link],
  Type,
  ComicNumber
FROM XKCDLinkComments

Enter Parameters

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