Last forum posts

This example shows last 5 messages from the test forum. It combines the Post table and the asset table.

The query looks like:

SELECT
content
FROM
Post,
asset
WHERE
asset.assetId=Post.assetId
AND
parentId = 'ey3i8YeXX7KFpVb7-VvkAQ'
AND
Post.revisionDate =
(SELECT
MAX(maxPostData.revisionDate)
FROM Post as maxPostData
WHERE Post.assetId=maxPostData.assetId)
ORDER BY
lineage
LIMIT 5

content
This is a first message in a forum.
This is the second main message in the test forum.