title: I want to display only one row per subject_id without using DISTINCT. Not sure how to go about it
body: <p><a href="https://i.stack.imgur.com/vj9sn.jpg" rel="nofollow noreferrer">Ouput of database</a>I am working with a large amount of data so DISTINCT freezes the database</p>
  
  <p>I have tried DISTINCT already on pgAdmin, no luck as of now. </p>
  
  <pre><code>SELECT p.subject_id,
      p.gender,
      p.dob,
      d.icd9_code, 
      pro.seq_num,
      pro.icd9_code,
      inpc.itemid inputevents,
      inp.itemid inputevents_mv,
      lab.itemid labevents,
      outp.itemid outputevents
  FROM mimiciii.patients p
  
  INNER JOIN mimiciii.diagnoses_icd d
      ON p.subject_id = d.subject_id
  INNER JOIN mimiciii.procedures_icd pro
      ON p.subject_id = pro.subject_id
  INNER JOIN mimiciii.labevents lab
      ON p.subject_id = lab.subject_id
  INNER JOIN mimiciii.inputevents_cv inpc
      ON p.subject_id = inpc.subject_id
  INNER JOIN mimiciii.inputevents_mv inp
      ON p.subject_id = inp.subject_id
  INNER JOIN mimiciii.outputevents outp
      ON p.subject_id = outp.subject_id
  WHERE d.icd9_code = '4299'
  </code></pre>
  
  <p>I keep getting a repeating value of subject_id.</p>