title: MySQL Join tables with virtual columns
body: <p>I want make virtual columns. In <code>list</code> id primary table, and I need join virtual columns with 'data'.</p>
  
  <pre><code>Table: columns
  +------+---------+-------------+
  | [ID] | ID_USER |   DATENAME  |
  +------+---------+-------------+
  |   1  |   NULL  | Description |
  +------+---------+-------------+
  |   2  |   NULL  |     Cost    |
  +------+---------+-------------+
  |   3  |    2    |    Width    |
  +------+---------+-------------+
  
  Table: list
  +----+-----------+------------+--------+
  |[ID]|    NAME   |    DATE    |  COLOR |
  +----+-----------+------------+--------+
  |  1 |  234/2016 | 2016-06-06 |   red  |
  +----+-----------+------------+--------+
  |  2 | 1000/2016 | 2016-06-07 |  blue  |
  +----+-----------+------------+--------+
  |  3 | 3456/2016 | 2016-06-08 | yellow |
  +----+-----------+------------+--------+
  
  
  Table: data
  +-----------+-----------+-------+
  | ID_REPAIR | ID_COLUMN | VALUE |
  +-----------+-----------+-------+
  |     1     |     1     |  aaaa |
  +-----------+-----------+-------+
  |     1     |     2     |  10$  |
  +-----------+-----------+-------+
  |     2     |     1     |  bbbb |
  +-----------+-----------+-------+
  |     2     |     2     |  20$  |
  +-----------+-----------+-------+
  |     3     |     1     |  cccc |
  +-----------+-----------+-------+
  |     3     |     2     |  30$  |
  +-----------+-----------+-------+
  
  
  Result:
  +------+-----------+------------+--------+-------------+------+
  | [ID] |    NAME   |    DATE    |  COLOR | Description | Cost |
  +------+-----------+------------+--------+-------------+------+
  |   1  |  234/2016 | 2016-06-06 |   red  |     aaaa    |  10$ |
  +------+-----------+------------+--------+-------------+------+
  |   2  | 1000/2016 | 2016-06-07 |  blue  |     bbbb    |  20$ |
  +------+-----------+------------+--------+-------------+------+
  |   3  | 3456/2016 | 2016-06-08 | yellow |     cccc    |  30$ |
  +------+-----------+------------+--------+-------------+------+
  </code></pre>
  
  <p>In this query I get names <code>columns</code>:</p>
  
  <pre><code>SELECT * FROM `columns` WHERE `id_user` IS NULL
  </code></pre>
  
  <p>And in PHP save IDs to variable, but on test I want generate table with only second column. In below code I want generate result with <code>Cost</code> column, but always is insert <code>Description</code> column:</p>
  
  <p>SQL:</p>
  
  <pre><code>SELECT `list`.`id`, `name`, `date`, `color`, `data`.`value`
  FROM `list` 
  INNER JOIN `data` ON `list`.`id` = `data`.`id_repair` WHERE `repair_data`.`id_column` = 2
  </code></pre>
  
  <p>I haven't idea how do INNER JOIN only WHERE id_column is equal 2</p>