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)

Craft CMS Meta

Q&A about the site for administrators, end users, developers and designers for Craft CMS

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, Text
  FROM comment_ranks
WHERE cmt_rank = 1;

Enter Parameters

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