title: PostgreSQL JOIN data from 3 tables
body: <p>I'm new to PostgreSQL and trying to get a query written. I'm pretty sure it's easy for someone who knows what they are doing - I just don't! :)</p>
  
  <p>Basically I have three tables. In the first, I store details about patients. In the second, I store a reference to each image of them. In the third, I store the link to the file path for the image. I didn't design the database, so I'm not sure why the image files table is separated, but it is.</p>
  
  <p>What I want to be able to do is select data from the first table, joining in data from a second then third table so I end up with the name &amp; file path in the result.</p>
  
  <p>So the basic structure is:</p>
  
  <pre><code>Table 1:
  person_id | name
  
  Table 2:
  person_id | image_id
  
  Table 3:
  image_id | `path filename`
  </code></pre>
  
  <p>What I want to do is in one query, grab the person's 'name' and the image 'path filename'.</p>
  
  <p>I'm happy with a "template" style answer with the join I need. I don't need it to be written in actual code. (i.e. I'm thinking you can just write me an answer that says <code>SELECT table1.name, table3.pathfilename FROM JOIN ... etc...</code>).</p>