title: MySQL - SELECT data and create a "virtual" table
body: <p>Let's say my database table looks like this:</p>
  
  <p><strong>page_table</strong></p>
  
  <pre><code>| id | page_id | meta_id | value
  ----------------------------------------
  | 1  | 2       | 1       | Testing value
  | 2  | 2       | 2       | Small content
  | 3  | 2       | 1       | Another value
  | 4  | 2       | 2       | Tiny value
  | 5  | 3       | 1       | Text
  | 6  | 3       | 2       | Content
  | 7  | 3       | 3       | New text
  </code></pre>
  
  <p><strong>meta_table</strong></p>
  
  <pre><code>| id | meta_id | meta_value
  -------------------------------
  |  1 | 1       | Big headline
  |  2 | 2       | Small headline
  |  3 | 3       | Extra headline
  </code></pre>
  
  <ul>
  <li>"id" is incremental.</li>
  <li>"page_id" is a page id. There can be many metas and values on one page.</li>
  <li>"meta_id" is connected to meta_table.</li>
  <li>"value" can be any string.</li>
  </ul>
  
  <p><strong>Question</strong></p>
  
  <p>Can I create a "virtual" SQL table to easy work with this data?</p>
  
  <p><strong>virtual table - my suggestion</strong></p>
  
  <pre><code>| id | page_id | Big headline  | Small headline | Extra headline
  ----------------------------------------------------------------
  | 1  | 2       | Testing value | Small content  |
  | 2  | 2       | Another value | Tiny value     |
  | 3  | 3       | Text          | Content        | New text
  </code></pre>
  
  <p>Above is the same content from both page table and meta table. This is what I want with my SQL.</p>
  
  <p><strong>How far I've come</strong></p>
  
  <p><code>SELECT * from page_table</code> will not do it this time.</p>