Posts with YouTube links on Music Fans

0

Please login or register to vote for this query.

(click on this box to dismiss)

Music Fans

Q&A for music historians, critics, and fans

SELECT
  COUNT(*) AS aantal,
  HasYouTube,
  PostType
FROM (
  SELECT
    p.Id AS PostId,
    CASE
      WHEN p.body LIKE '%youtube.com%' OR p.body LIKE '%youtu.be%'
      THEN 1
      ELSE 0
    END AS HasYouTube,
    pt.name AS PostType
  FROM Posts p
  LEFT JOIN PostTypes pt ON pt.id = p.PostTypeId
) pp
GROUP BY
  HasYouTube,
  PostType
ORDER BY
  PostType,
  HasYouTube DESC

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results