title: counting employee attendance
body: <p>I am trying to write a statement for counting the employees attendance and execute their <code>id</code> , <code>name</code> and the days that he has working on the last 3 months by counting the duplicate <code>id</code> on <code>NewTimeAttendance</code>  for month 1, 2 and 3.</p>
  
  <p>I tried to count:</p>
  
  <pre><code>Select COUNT(employeeid)
    from NewTimeAttendance
   where employeeid=1 and (month=1 or month = 2 or month = 3)
  </code></pre>
  
  <p>This is absolutely working, but just for one employee.</p>
  
  <p>The second try: </p>
  
  <pre><code>SELECT COUNT(NewEmployee.EmployeeID)
    FROM NewEmployee INNER JOIN NewTimeAttendance 
      ON NewEmployee.EmployeeID = NewTimeAttendance.EmployeeID
     and (month=1 or month =2 or month = 3)
  </code></pre>
  
  <p>This is working, but it counts all employees and I want it to execute each <code>EmployeeId</code>, <code>EmployeeName</code> and <code>number of days</code> as new record.</p>
  
  <p>Last try: (before you see the code ... it is wrong ..but I am trying)</p>
  
  <pre><code>for i in  0..27 loop
     SELECT COUNT(NewEmployee.EmployeeID),NewEmployee.EmployeeId,EmployeeName
       FROM NewEmployee INNER JOIN NewTimeAttendance 
         ON NewEmployee.EmployeeID(i) = NewTimeAttendance.EmployeeID
        and (month=1 or month =2 or month = 3)
  end loop
  </code></pre>
  
  <p>I really need help...thanks in advance.</p>