title: Mysql query to get detail of comma-separated ids data
body: <p>I have 2 tables, items and members :</p>
  
  <pre><code>CREATE TABLE IF NOT EXISTS `items` (
  `id` int(5) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `member` varchar(255) NOT NULL,
  PRIMARY KEY (`id`)
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  CREATE TABLE IF NOT EXISTS `members` (
    `id` int(5) NOT NULL AUTO_INCREMENT,
    `name` varchar(255) NOT NULL,
    PRIMARY KEY (`id`)
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  </code></pre>
  
  <p>What if, for example I have a record inside <code>items</code>, such as</p>
  
  <pre><code>INSERT INTO  `test`.`items` (
  `id` ,
  `name` ,
  `member`
  )
  VALUES (
  NULL ,  'xxxx',  '1, 2, 3'
  );
  </code></pre>
  
  <p>in <code>members</code> :</p>
  
  <pre><code>INSERT INTO `members` (`id`, `name`) VALUES
  (1, 'asdf'),
  (2, 'qwert'),
  (3, 'uiop'),
  (4, 'jkl;');
  </code></pre>
  
  <p>and I'd like to display <code>items.member</code> data with <code>members.name</code>, something like <code>1#asdf, 2#qwert, 3#uiop</code>??</p>
  
  <p>I've tried the following query,</p>
  
  <pre><code>SELECT items.id, items.name, GROUP_CONCAT(CONCAT_WS('#', members.id, members.name) ) as member
  
  FROM `items` 
  LEFT JOIN members AS members on (members.id = items.member)
  WHERE items.id = 1
  </code></pre>
  
  <p>But the result is not like I expected. Is there any other way to display the data via one call query? Because I'm using PHP, right now, i'm explode <code>items.member</code> and loop it one by one, to display the <code>members.name</code>.</p>