title: How to join three table if one key value should be or should not be in a table?
body: <p>I am trying to design an app, In which i want to fetch the values in a 
  either or condition using query, 
  I have three tables: text,image,audio in each table complaint_id column is same.</p>
  
  <p>Note: the record get inserted in a table text is compulsory.</p>
  
  <p>but in the case of image and audio it may or may not insert a record 
  (because it depend on user whether to insert image or audio)</p>
  
  <p>table: text</p>
  
  <pre><code>complaint_id | text_note
  ------------------------
     34556     | Hello
     34557     | welcome  
  </code></pre>
  
  <p>table: image</p>
  
  <pre><code>complaint_id | photo_link
  -----------------------------
     34556     | photo_link
  </code></pre>
  
  <p>table: audio</p>
  
  <pre><code>complaint_id | audio_link
  ----------------------------
     34557     | audio_link
  </code></pre>
  
  <p>I want output as</p>
  
  <pre><code>complaint_id | text_note | photo_link     | audio_link
  ------------- ----------- ---------------- --------------
  34556        |  Hello    | photo_link     |
  34557        |  welcome  |                | audio_link
  </code></pre>
  
  <p>I have designed one query but it doesn't wok for me! </p>
  
  <pre><code>SELECT
      *
  FROM
      test t
  JOIN image i ON (
      t.complaint_id = i.complaint_id
  )
  JOIN audio a ON (
      t.complaint_id = a.complaint_id
  )
  GROUP BY
      t.complaint_id
  </code></pre>