WITH SortedComments AS ( SELECT PostId, Text AS Comment, ...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Music Fans Meta

Q&A about the site for music historians, critics, and fans

WITH SortedComments AS (
      SELECT PostId, Text AS Comment,
      CreationDate,
      ROW_NUMBER() OVER (PARTITION BY PostId ORDER BY CreationDate DESC) AS RN
      FROM Comments
      WHERE PostId in (74996040,39033194)
      ) 
SELECT p.Id, sc.Comment
FROM 
Posts p
LEFT JOIN
SortedComments sc
ON p.Id = sc.PostId
WHERE ISNULL(sc.RN,0) <= 1

Enter Parameters

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