Q:

Count references to own ID in MySQL with Grouping

I'm running a query on posts in a database. If the post is a response to another post, it has a parent_id greater than zero otherwise zero.
To generate a report on posts, I use the following in my SELECT and then group by user.
SELECT
    SUM(IF(parent_id = 0, 1, 0)) as 'NewPosts',
    SUM(IF(parent_id > 0, 1,0))  as 'Responses',
    COUNT(parent_id)             as 'TotalPosts',
FROM posts
GROUP BY user

Now I need to add a column that show's self responses by a user. Something like...
SUM(IF(parent_id IN id, 1, 0)) as 'SelfResponses'

Of course I know that is wrong but I hope it sends the idea across.
Edit: Data would look like :
User        Id        parent_id
Henry       12          0
Henry       24          12
Henry       32          16
Joseph      16          0

So in this case the output would be:
User         NewPosts        Responses     TotalPosts        SelfResponses
Henry          2                2             3                    1
Joseph         1                0             1                    0

A:

Assuming for response the parentId is the postId for the response then you can achieve this by the following way
Query 1:
SELECT
   a.user,
   SUM(IF(a.parent_id = 0, 1, 0)) as 'NewPosts',
   SUM(IF(a.parent_id > 0, 1,0))  as 'Responses',
   COUNT(a.parent_id)             as 'TotalPosts',
   SUM(IF(a.user = b.user, 1, 0)) as 'SelfResponses'
FROM 
  Table1 a
LEFT JOIN
  Table1 b
ON 
  a.parent_id = b.id
GROUP BY 
  a.user

Results:
|   USER | NEWPOSTS | RESPONSES | TOTALPOSTS | SELFRESPONSES |
--------------------------------------------------------------
|  Henry |        1 |         2 |          3 |             1 |
| Joseph |        1 |         0 |          1 |             0 |

SQL FIDDLE
Hope this helps

