I feel stupid for asking, but I have a small problem with my SQL.
Lets say, you have a Table with the following columns:
id (= The id of the post)
replyto (= The id of the post this post replies to)
replies (= The count of replies)
What I want to do, make a SQL query, that counts how many replies a post has and stores it in replies.
The Problem I'm having is that the id of the post and the reply count are in the same table, if it were different tables it would work, like how I count the like count.
UPDATE posts
SET likes = (SELECT COUNT(likes.id) FROM likes WHERE postid = posts.id)
But because I store replies as a post that have a set replyto value and a store in the same table, the above code does not work.