title: MYSQL query from different tables same ID
body: <p>i'm really confused in how to do this in mysql and if it's possible at all. I have a table where i need to select articles which have id = idi:</p>
  <pre><code>$query-&gt;select('title, id, idi, introtext');
  $query-&gt;from('#__content');
  $query-&gt;where('idi = ' . $id);
  </code></pre>
  <p>So, now component shows main article ( id ) and extra articles which has same IDI as ID.</p>
  <h1>__content table</h1>
  <pre><code>ID IDI
  0    0
  1    0
  2    1
  3    1
  </code></pre>
  <p>So, article with ID 1 will have extra articles with ID 2,3 because IDI is 1. ID=IDI</p>
  <p>And now i need to get extra articles voting_results from table ratings where votings_results ID are equal to #__content id.</p>
  <h1>__ratings table</h1>
  <pre><code>ID voting_result1
  0           55
  1          123
  2           64          &lt;--
  3           42          &lt;--
  </code></pre>