I am trying to create SQL for retrieveing a list of latests posts for the forum thread. I have the following code:
SELECT
item_discuss_thread_id
, item_dis
Try this.
SELECT
*
FROM
(SELECT item_discuss_thread_id, item_discuss_post_title, COUNT(item_discuss_thread_id) AS nb_posts
FROM item_discuss_posts
ORDER BY __datecolumn__)
AS ordered_by_date
GROUP BY
ordered_by_date.item_discuss_thread_id
Replace __datecolumn__ with the column that stores posting time.