title: Using Count with Group Concat
body: <p><a href="http://sqlfiddle.com/#!2/271eb/1" rel="nofollow">Fiddle Example</a></p>
  
  <p>I have a page that lists multiple polls and all of their vote options from table <code>vote_option</code>. I use the table <code>user_vote</code> to store the users' vote records. I want to retrieve from that table the vote result for each vote option in each poll. Can anyone show me how to use <code>GROUP_CONCAT</code> with <code>SELECT COUNT(*) FROM user_vote GROUP BY product_id</code> so that the result would be like this:</p>
  
  <pre><code>Poll_TITLE   VOTE_OPTION                     IMG                VOTE_COUNT &lt;---how to get this column 
  Title A      Product A,Product B,Product C   imgA,imgB,imgC     2,0,1  
  Title B      Product A,Product B,Product D   imgA,imgB,imgD     0,1,0
  Title C      Product D,Product E             imgD,imgE          1,0  
  </code></pre>
  
  <p>Table Schema:</p>
  
  <pre><code>CREATE TABLE poll
      (`poll_id` int,`title`varchar(30))
  ;
  
  INSERT INTO poll
      (`poll_id`,`title`)
  VALUES
      (1,'Title A'),
      (2,'Title B'),
      (3,'Title C')
  
  ;
  
  CREATE TABLE product
      (`product_id` int,`product_name` varchar(30),`img`varchar(30))
  ;
  
  INSERT INTO product
      (`product_id`,`product_name`,`img`)
  VALUES
      (1,'Product A','imgA'),
      (2,'Product B','imgB'),
      (3,'Product C','imgC'),
      (4,'Product D','imgD'),
      (5,'Product E','imgE')
  ;
  
  CREATE TABLE vote_option
      (`poll_id` int,`product_id` int)
  ;
  
  INSERT INTO vote_option
      (`poll_id`,`product_id`)
  VALUES
      (1,1),
      (1,2),
      (1,3),
      (2,1),
      (2,2),
      (2,4),
      (2,2),
      (3,4),
      (3,5)
  
  ;
  
  CREATE TABLE user_vote
      (`poll_id` int,`product_id` int,`user_id` int)
  ;
  
  INSERT INTO user_vote
      (`poll_id`,`product_id`,`user_id`)
  VALUES
      (1,1,1),
      (1,1,2),
      (1,3,2),
      (2,2,1),
      (3,4,1)
  ;
  
  CREATE TABLE user
      (`user_id` int,`user_name` varchar (30))
  ;
  
  INSERT INTO user
      (`user_id`,`user_name`)
  VALUES
      (1,'Tom'),
      (2,'Sally')
  ;
  </code></pre>