title: Treating Null values and duplicate records in SQL Server
body: <p>I have a scenario where I am working on <code>SQL Server Reporting Services</code> for creating a tablular report and stuck at a point where I get duplicate values for one column. Below is the sample output from the code:</p>
  
  <pre><code>AppID   EmpID   EmpName
  2002912 81555   NULL
  2002912 81588   Jenn - 81588
  2026880 9328    NULL
  2026880 9628    Brad  - 09628
  2027065 92174   Julie - 92174
  2027065 92714   NULL
  2028989 72138   NULL
  2028989 91366   Alan - 91366
  2029233 17438   NULL
  2029233 53712   Brad - 53712
  2031585 37902   NULL
  2031588 17723   Richard - 17723
  2031591 54551   Paula - 54551
  2031593 52240   Sarah - 52240
  2031597 72778   Daisy - 72778
  2031603 12659   NULL
  </code></pre>
  
  <p>Notice the first coulmn (<code>AppID</code>) has few duplicates and the corresponding column <code>EmpName</code> is either <code>Null</code> or has some value. I want to eliminate all the duplicate <code>AppID's</code> where the <code>EmpName</code> is <code>null</code>. </p>
  
  <p>This could have been straight forward if there were no null values for unique <code>AppID</code>'s (Refer to the last row) also I can't hardcode as I am dealing with large number of data. </p>
  
  <p>Also please note, all these three columns are coming from different table and have been <code>LEFT JOIN</code> to <code>AppID</code> table. Please let me know if you require to see the code, I didn't paste it here as it is little complex and though might not be required.</p>
  
  <p>Any kind of help and suggestion is appreciated.Thank you</p>