title: SQL How to count unique value in a column only once per person per day
body: <p>I have an SQL table the displays names of people who scan to a bar code.
  They often scan to multiple bar codes per day and sometimes the same code on the same day.
  I need to count the amount of scan types for each person each day.
  The problem I am having is that I don't want to count the same bar code value for the one person each day.</p>
  
  <p>Below is an example of the SQL table.</p>
  
  <p><img src="https://i.stack.imgur.com/mDucc.jpg" alt="Example SQL Table"></p>
  
  <p>Here is my SQL</p>
  
  <pre><code>SELECT EVENTDATE, BARCODE, count(BARCODE) AMOUNT
  from TIMESHEET
  where EVENTDATE = '27-OCT-17' 
  group by EVENTDATE, BARCODE
  order by EVENTDATE, BARCODE
  </code></pre>
  
  <p>The result gives me a count of 5 but I want only 4 because there are two duplicate bar code scans for JOHN SMITH for the same day.</p>