title: SQL: How to avoid duplicate values
body: <p>This is my query:</p>
  
  <pre><code>SELECT DISTINCT 
      ca.id_number,
      CONVERT(VARCHAR(19),MAX(ca.creation_time),120) as creation_time,
      CONVERT(VARCHAR(19),MAX(cc.close_date),120) as close_date,
      cc.summary
  FROM dbo.table_case ca
      INNER JOIN table_case_display cd on cd.id_number = ca.id_number
      INNER JOIN table_act_entry acte on ca.objid = acte.act_entry2case
      INNER JOIN table_gbst_elm elm on elm.objid = acte.entry_name2gbst_elm
      LEFT JOIN table_close_case cc on acte.objid = cc.close_case2act_entry 
  WHERE 
      "cd"."creation_time"&gt;={ts '2004-09-30 19:58:21'} 
      AND  "ca"."id_number"&lt;&gt;'001' 
      AND ( "cd"."severity"='A' 
      OR "cd"."severity"='B' 
      OR "cd"."severity"='C' 
      OR "cd"."severity"='E' 
      OR "cd"."severity"='TBD') 
      AND "cd"."site_name"='Nextel International (Hosting)'
      AND (ca.creation_time&gt;={ts '2014-03-01 00:00:00'} AND ca.creation_time&lt;{ts '2014-04-10 00:00:01'})
  GROUP BY ca.creation_time, cc.close_date, ca.id_number, cc.summary
  ORDER BY ca.id_number asc
  </code></pre>
  
  <p>This is the output:</p>
  
  <pre><code>C00001  2014-03-10 20:35:17 NULL                    NULL
  C00002  2014-03-11 03:16:01 NULL                    NULL
  C00002  2014-03-11 03:16:01 2014-03-11 18:10:41     test
  C00003  2014-03-07 02:53:22 NULL                    NULL
  C00003  2014-03-07 02:53:22 2014-03-12 18:41:59     test 
  </code></pre>
  
  <p>From the above output, it's showing duplicate IDs.
  How to write a query in order to avoid this issue?</p>