WITH comment_ranks AS( SELECT cm.Id, cm.PostId, cm.Text, ...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Open Source Meta

Q&A about the site for people organizing, marketing or licensing open source development projects

WITH comment_ranks AS(
SELECT cm.Id, cm.PostId, cm.Text,
       RANK() OVER (
       PARTITION BY cm.PostId
       ORDER BY cm.CreationDate DESC ) cmt_rank
FROM comments cm
)
select PostId, count(1)
from (
SELECT PostId, Text
  FROM comment_ranks
WHERE cmt_rank = 1
) s
group by PostId
having count(1) > 1

Enter Parameters

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