SELECT TOP 100 p.Id AS PostId, p.Title, p.Score AS PostSc...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Drones and Model Aircraft Meta

Q&A for experienced flyers, pilots, and builders of drones and model aircraft

SELECT TOP 100
      p.Id AS PostId,
      p.Title,
      p.Score AS PostScore,
      p.ViewCount,
      COUNT(DISTINCT c.Id) AS CommentCount,
      AVG(CAST(c.Score AS FLOAT)) AS AvgCommentScore,
      'https://travel.stackexchange.com/questions/' + CAST(p.Id AS VARCHAR) AS QuestionURL,
      p.CreationDate,
      p.LastActivityDate
FROM Posts p
LEFT JOIN Comments c ON p.Id = c.PostId
LEFT JOIN PostTags pt ON p.Id = pt.PostId
LEFT JOIN Tags t ON pt.TagId = t.Id
WHERE p.PostTypeId = 1 -- Questions only
  AND t.TagName = 'airport'
  AND (p.Title LIKE '%cab%'
       OR p.Title LIKE '%taxi%')
GROUP BY 
      p.Id, 
      p.Title, 
      p.Score, 
      p.ViewCount, 
      p.CreationDate, 
      p.LastActivityDate
HAVING COUNT(DISTINCT c.Id) > 1
ORDER BY p.Score DESC;

Enter Parameters

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