I have asked this before, but recieved only a single reply. I have since revised my question.
I have a multi-threaded message board, and PHP script that cycles through each message, and creates a link that allows that message to be viewed. I would also like to include a reply count. I would like to have it count all of the messages where the parent_id field equals the post_id field, but also include it in my general query.
SELECT post_id,subject,count(?) as replies FROM boards WHERE parent_id='" . $_GET["post"] . "';";
I am unsure how to do this, other than by running 2 queries, one that gets the post_id, and subject, and one that counts the replies, but i would like to be able to include all of this together, in a single sql query.
I originally wished to be able to count the replies to the replies, but I will settle for being able to get the number of replies to a single message, and not any of it's replies.
Can anybody help? or will I have to run two queries?