title: SQL Server 2008: How to fix duplicate values in one column based on other
body: <p>Hi I have searched a lot on this and i guess i cant put it correctly for any search engine to understand. Hence requesting your help.</p>
  
  <p>I am joining two tables 1) Calls and 2) Transfers</p>
  
  <p>The output from calls table is Date, Name &amp; Calls, 1 entry for each person for that date.</p>
  
  <p>The output from transfers table will be date, name, transferred from, transferred to, transfers</p>
  
  <p>when join these two tables using agent &amp; date combination, call entries get duplicated which will be the case as one person will have multiple transfer from and to departments on a particular date.</p>
  
  <p>I want to consider calls only once so that i can calculate transfer %</p>
  
  <p>Example below:
  Calls Table output:</p>
  
  <pre><code>Date    Agent   Calls
  01/05/2016  Mark    20
  </code></pre>
  
  <p>Transfers table output:</p>
  
  <pre><code>Date    Agent   Trf From    Trf To  Transfers
  01/05/2016  Mark    Dept A  Dept B  10
  01/05/2016  Mark    Dept A  Dept C  5
  01/05/2016  Mark    Dept A  Dept D  2
  </code></pre>
  
  <p>Joined Output</p>
  
  <pre><code>Date    Agent   Calls   Trf From    Trf To  Transfers
  01/05/2016  Mark    20  Dept A  Dept B  10
  01/05/2016  Mark    20  Dept A  Dept C  5
  01/05/2016  Mark    20  Dept A  Dept D  2
  </code></pre>
  
  <p>Output I  need</p>
  
  <pre><code>Date    Agent   Calls   Trf From    Trf To  Transfers
  01/05/2016  Mark    20  Dept A  Dept B  10
  01/05/2016  Mark    0   Dept A  Dept C  5
  01/05/2016  Mark    0   Dept A  Dept D  2
  </code></pre>