I have a forum-like site, which allows users to post. I want users to be able to delete their post ONLY if it is the last for this topic:
Posts Table
+--+-------+------+------+------+--------+
|id|content|author|posted|edited|question|
+--+-------+------+------+------+--------+
How to check is this post is the last post on this question?
This for select max id:
and for select the id of the last post of an author: