sub_id from the Submissions table where parent_id is NULL. This will give us the unique post IDs.LEFT JOIN on the Submissions table with itself, joining on the condition that the sub_id of the first instance (representing a post) matches the parent_id of the second instance (representing a comment).COUNT(DISTINCT ...) to count the unique sub_id of comments for each post, ensuring that duplicate comments are only counted once.sub_id of the posts.post_id in ascending order.
erDiagram
    Submissions {
        int sub_id PK
        int parent_id
    }