title: SQL - how to SELECT multiple tables and JOIN multiple rows from the same column?
body: <p>How to SELECT multiple tables and JOIN multiple rows from the same column?</p>
  
  <p>It does not return <code>painting.id_group</code>, <code>painting.id_type</code> and <code>painting.id_location</code>.
  I'm sure this SQL snippet has wrong syntax.</p>
  
  <pre><code>SELECT painting.id, painting.order, painting_en.url, id_portfolio.en
  FROM painting
  LEFT JOIN painting_en
  USING ( id ) 
  LEFT JOIN id_portfolio ON id_portfolio.id = painting.id_group
  AND id_portfolio.id = painting.id_type
  AND id_portfolio.id = painting.id_location
  WHERE painting_en.url='2011-name3'
  LIMIT 1
  </code></pre>
  
  <p><strong>Update:</strong>
  It shows <code>Showing rows 0 - 0 ( 1 total, Query took 0.0004 sec)</code>.
  After removing</p>
  
  <pre><code>AND id_portfolio.id = painting.id_type
  AND id_portfolio.id = painting.id_location
  </code></pre>
  
  <p>it returns:</p>
  
  <pre><code>id        | order | url        |en
  ----------+-------+------------+-----
  09518709  | 4     | 2011-name3 | NULL
  </code></pre>
  
  <p>but I need to return:</p>
  
  <pre><code>id        | order | url        | group   | type          | location
  ----------+-------+------------+---------+---------------+---------
  09518709  | 4     | 2011-name3 | realism | oil on canvas | US
  </code></pre>