Check for the nth post - count


XenForo moderator
Staff member
Hmmm, this is easy for a thread as you just change the ID to 2000 but for a post it needs the thread ID.

I can't find an obvious way of doing it without querying the DB.

Jake Bunce

XenForo moderator
Staff member
Note that selecting the 2000th post by postid will ignore gaps in the postid values. Gaps are created when posts are deleted.

This query will select the 2000th post record of the posts that currently exist:

FROM xf_post
ORDER BY post_id
LIMIT 1999, 1
One method is not more correct than the other. It just depends on how you want to identify the 2000th post.