title: count in group_concat in mysql in one query
body: <p>I have one to many table relationship :</p>
  
  <ul>
  <li>one <code>user</code> for multiple <code>event</code></li>
  <li>one <code>event</code> for multiple <code>event_attribute</code> </li>
  </ul>
  
  <p>Now, I group by <code>userId</code> and want to know <strong>how many for each event attribute</strong> ?</p>
  
  <p>Below is the data schema you can use:</p>
  
  <p>To be more specific, this is the DB schema I am using:</p>
  
  <pre><code>CREATE TABLE `user` (
    `id` int(11) NOT NULL,
    `name` varchar(45) DEFAULT NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `id_UNIQUE` (`id`)
  );
  CREATE TABLE `event` (
    `id` int(11) NOT NULL,
    `name` varchar(45) DEFAULT NULL,
    `user_id` int(11) DEFAULT NULL,
    PRIMARY KEY (`id`)
  );
  CREATE TABLE `event_attr` (
    `id` int(11) NOT NULL,
    `att_name` varchar(45) DEFAULT NULL,
    `event_id` varchar(45) DEFAULT NULL,
    PRIMARY KEY (`id`)
  );
  INSERT INTO `user` VALUES (1,'user1'),(2,'user2'),(3,'user3');
  INSERT INTO `event` VALUES (1,'event1',1),(2,'event2',1),(3,'event3',1),(4,'event4',2),(5,'event5',2),(6,'event6',3);
  INSERT INTO `event_attr` VALUES (1,'att1','1'),(2,'att2','1'),(3,'att3','1'),(4,'att1','2'),(5,'att2',NULL);
  </code></pre>
  
  <p>Now if I am running:</p>
  
  <pre><code>select u.id, group_concat(e.name)
  from user u 
  join event e on u.id=e.user_id 
  group by u.id
  </code></pre>
  
  <p>I will get:</p>
  
  <pre><code>1 event1,event2,event3
  2 event4,event6
  3 event 6
  </code></pre>
  
  <p>That is fine. But one step forward, I need to know count for each event_attt for each user, such as:</p>
  
  <pre><code>1 evet_att1:3;event_att2:2
  2 event_att3:1
  </code></pre>
  
  <p>Then it is not possible. Can I use just one query to get above expected response?</p>