title: mysql get table based on common column between two tables
body: <p>while trying to learn sql i came across "Learn SQL The Hard Way" and i started reading it.
  Everything was going fine then i thought ,as a way to practice, to make something like given example in the book (example consists in 3 tables pet,person,person_pet and the person_pet table 'links' pets to their owners).</p>
  
  <p>I made this:</p>
  
  <pre><code>report table
  +----+-------------+
  | id | content     |
  +----+-------------+
  |  1 | bank robbery|
  |  2 | invalid     |
  |  3 | cat on tree |
  +----+-------------+
  notes table
  +-----------+--------------------+
  | report_id | content            |
  +-----------+--------------------+
  |  1        | they had guns      |
  |  3        | cat was saved      |
  +-----------+--------------------+
  
  wanted result
  +-----------+--------------------+---------------+
  | report_id | report_content     | report_notes  |
  +-----------+--------------------+---------------+
  |  1        | bank robbery       | they had guns |
  |  2        | invalid            | null or ''    |
  |  3        | cat on tree        | cat was saved |
  +-----------+--------------------+---------------+
  </code></pre>
  
  <p>I tried a few combinations but no success.</p>
  
  <p>My first thought was</p>
  
  <pre><code>SELECT report.id,report.content AS report_content,note.content AS note_content
  FROM report,note
  WHERE report.id = note.report_id
  </code></pre>
  
  <p>but this only returns the ones that have a match (would not return the invalid report).
  after this i tried adding IF conditions but i just made it worse.</p>
  
  <p>My question is, is this something i will figure out after getting past basic sql
  or can this be done in simple way?</p>
  
  <p>Anyway i would appreciate any help, i pretty much lost with this.</p>
  
  <p>Thank you.</p>
  
  <p>EDIT: i have looked into related questions but havent yet found one that solves my problem.
  I probably need to look into other statements such as join or something to sort this out.</p>