title: select 3 tables in 3 array fields 1 mysql query
body: <p>First of all my tables</p>
  
  <p>I have stored my product's format/template data in the first table. A format/template can be used by many product.</p>
  
  <pre><code>Format meta table. Primary Key is format_id. (has some more other columns)
  +-----------+-------+
  | format_id | title |
  +-----------+-------+
  |     1     |  f.a  |
  |     2     |  f.b  |
  |     3     |  f.c  |
  |     4     |  f.d  |
  +-----------+-------+
  </code></pre>
  
  <p>In the second table I'm storing product data. Every product has a unique ID and uses only one unique Format/Template. This table contains data like product_price, product_quantity etc. Details of each Product is being saved in another table.</p>
  
  <pre><code>Product meta table. Primary Key is product_id. (has some more other columns)
  +-----------+------------+-------+
  | format_id | product_id | title |
  +-----------+------------+-------+
  |     1     |      1     |  p.a  |
  |     1     |      2     |  p.b  |
  |     1     |      3     |  p.c  |
  |     1     |      4     |  p.d  |
  +-----------+------------+-------+
  </code></pre>
  
  <p>This is the final table where I'm saving Product's details. Here values are stored in cell_id => value pair.</p>
  
  <pre><code>Details table. No primary key. (has some more other columns)
  +-----------+------------+---------+-------+
  | format_id | product_id | cell_id | value |
  +-----------+------------+---------+-------+
  |     1     |      1     |    1    |  d.a  |
  |     1     |      1     |    2    |  d.b  |
  |     1     |      1     |    3    |  d.c  |
  |     1     |      1     |    4    |  d.d  |
  +-----------+------------+---------+-------+
  </code></pre>
  
  <p>Now the result I want</p>
  
  <pre><code>$result =&gt; ['format_meta']  =&gt; ['format_id'] = 1
                              =&gt; ['title']     = f.a
  
             ['product_meta'] =&gt; ['format_id']  = 1
                              =&gt; ['product_id'] = 1
                              =&gt; ['title']      = p.a
  
             ['details']      =&gt; [0]   =&gt; ['format_id']  = 1
                                       =&gt; ['product_id'] = 1
                                       =&gt; ['cell_id']    = 1
                                       =&gt; ['value']      = d.a
  
                              =&gt; [1]   =&gt; ['format_id']  = 1
                                       =&gt; ['product_id'] = 1
                                       =&gt; ['cell_id']    = 2
                                       =&gt; ['value']      = d.b
  
                              =&gt; [2]   =&gt; ['format_id']  = 1
                                       =&gt; ['product_id'] = 1
                                       =&gt; ['cell_id']    = 3
                                       =&gt; ['value']      = d.c
  </code></pre>
  
  <p>I am totally clueless about how to do this. </p>