I know this is something very easy to do but i have not gotten the correct way to do it. i found something Here but different from what i need and no active contribution yet. Someone kindly assist.
I have a table like this
name |status
-------------
mike |yes
mike |yes
mike |no
mike |ney
john |no
john |ney
john |yes
i want to output something like this
name |status           |total
------------------------------
mike |yes-2,no-1,ney-1 | 4
john |yes-1,no-1,ney-1 | 3
I tried using GROUP_CONCAT like this
    result = mysql_query("SELECT name, GROUP_CONCAT(DISTINCT status) AS status 
FROM table GROUP BY name ");
        while($row = mysql_fetch_array($result)){ 
    $st[] = $row['status'];
            $status=explode(",",$row['status']);
            $total = count($status);
            echo $row['name']."|".$row['status']."|".$total."<br><br>"; }
I would like to get the number of each distinct $row['status'] and if possible, a better way of arriving at $total.
EDIT1
name | yes | no | ney | total
------------------------------
mike |2    |1   |1    | 4
john |1    |1   |1    | 3
This second output was achieved Here