title: joining on a table that references another table's column twice
body: <p>I have this table <code>Meeting</code> in <strong>POSTGRESQL</strong> that looks like:</p>
  
  <pre><code>id | subject  | time                |
  1  | Eat stuff| 2017-08-23 00:00:00 |
  2  | Do stuff | 2017-08-28 00:00:00 |
  </code></pre>
  
  <p>And another table <code>SimilarMeeting</code> that looks like:</p>
  
  <pre><code>meetingId | similarId | score |
  1         | 2         | 0.8   |
  </code></pre>
  
  <p>where <code>SimilarMeeting.meetingId</code> and <code>SimilarMeeting.similarId</code> are foreign keys to the <code>Meeting</code> table. I'm trying to generate a join statement that'd give me a result that looks like:</p>
  
  <pre><code>meetingSubject | similarSubject | score
  Eat stuff      | Do stuff       | 0.8
  </code></pre>
  
  <p>I'm kinda stumped here as two inner joins don't work here since the first inner join and second inner join reference two different <code>Meeting</code> rows.</p>
  
  <pre><code>select "ma"."subject", "mb"."subject",     
  "eva"."SimilarMeeting"."similarityScore" from "eva"."SimilarMeeting" 
  join "eva"."Meeting" AS ma on "eva"."SimilarMeeting"."meetingId" = "ma"."id"
  join "eva"."Meeting" AS mb on "eva"."SimilarMeeting"."similarId" = "ma"."id"
  </code></pre>