title: How to use two joins on a sql query? Syntax
body: <p>Sorry asking such a newbie question but I've been trying to understand this SQL query and add a thing and i can't make it happen.</p>
  
  <p>Here is the query:</p>
  
  <pre><code>select 
      p.id, p.nick, p.creation_date 
  from 
      tb_player p 
  left outer join 
      tb_invoice i on (i.player_id = p.id), tb_player_last_login tpl
  where 
      p.creation_date &lt; now() - '12 months'::interval 
      and tpl.last_login_date &lt; now() - '12 months'::interval 
      and tpl.player_id = p.id
      and p.id &gt; 9999
      and (p.email = 'EDITE-SEU-EMAIL' or p.email = 'configure-seu-email')
      and i.id is null
  limit 15000;
  </code></pre>
  
  <p>So I'm selecting a group of people from this <code>tb_player</code> and I have another table called <code>tb_email_list</code> and I need to say somewhere to include the players of <code>tb_player</code> that have the same email of <code>tb_email_list</code> that are valid.</p>
  
  <ul>
  <li><code>tb_player</code> has nick and email camp </li>
  <li><code>tb_email_list</code> player_id, email, is_valid </li>
  </ul>
  
  <p>I tried to put some joins but nothing I do seems to work... </p>
  
  <p>A little help please?</p>
  
  <p>My friend helped me and it goes like</p>
  
  <pre><code>select p.id, p.nick, p.creation_date 
  from tb_player_last_login tpl, tb_player p 
  left outer join tb_invoice i on (i.player_id = p.id)
  left join tb_email_list e on e.player_id = p.id
  where p.creation_date &lt; now() - '12 months'::interval 
  and tpl.last_login_date &lt; now() - '12 months'::interval 
  and tpl.player_id = p.id
  and p.id &gt; 9999
  and (p.email = 'EDITE-SEU-EMAIL' or p.email = 'configure-seu-email' or e.is_valid = -1)
  and i.id is null
  limit 15000
  </code></pre>
  
  <p>Thanks for the help</p>