title: How to use Distinct in WHERE clause
body: <p>I have this query to count the number of presents employee have in a month.</p>
  
  <pre><code>SELECT DISTINCT 
      COUNT([Attendance].[Status])
  FROM
      [HRM].[tbl_EmployeeAttendance] [Attendance], [HRM].[tbl_EmployeeInfo] [Info]
  WHERE 
      [Attendance].[Status] IN ('Early Left', 'Present', 'Half Day', 'Late In')
      AND [Info].[ID] = [Attendance].[EmpCode] 
      AND [Attendance].[EmpCode] = 266 
      AND CAST([Attendance].[AttendanceTimeIn] AS DATE) &gt;= '2018-08-01' 
      AND CAST([Attendance].[AttendanceTimeOut] AS DATE) &lt;= '2018-08-15'
  </code></pre>
  
  <p>Now there are plenty of employees that have been marked there attendance twice or thrice in one date. Like once an employee leave his attendance is placed as out and once he comes than as timein. So now on counting it is adding same days attendance multiple times. I want to get distinct dates between the dates.</p>
  
  <p>Here is sample data:</p>
  
  <pre><code>2018-04-04 18:12:30  2018-04-04 19:38:12   266  Present
  2018-04-04 09:43:01  2018-04-04 09:58:41   266  Present
  2018-04-05 16:40:52  2018-04-05 18:40:52   266  Present
  2018-04-06 11:35:59  2018-04-06 11:48:49   266  Present
  </code></pre>
  
  <p>Now it is counting date 4 two times but it should count it single time.</p>