SQL; Sort by date and count

D

Dave Elliott

Need to sort by employees on the same day where the employee count is more
than 2
need count of days or how many times where this is true

then show all employees less than 2
and count how many times where this is true





SELECT EmpCalc.[Work Date], Format([Work Date],"dddd") AS [Day],
EmpCalc.[First Name], EmpCalc.[Last Name], Time.TimeCounter,
EmpCalc.EmployeeID, EmpCalc.SinMar, EmpCalc.NoAllow, EmpCalc.PayRate,
EmpCalc.Hours, EmpCalc.RegPay, EmpCalc.OTRate, EmpCalc.Overtime,
EmpCalc.OTPay, EmpCalc.ExpPayPerDay, EmpCalc.TimeID, EmpCalc.HoursID,
EmpCalc.ChkNoID, EmpCalc.Paid
FROM EmpCalc INNER JOIN [Time] ON EmpCalc.TimeID = Time.TimeID
GROUP BY EmpCalc.[Work Date], Format([Work Date],"dddd"), EmpCalc.[First
Name], EmpCalc.[Last Name], Time.TimeCounter, EmpCalc.EmployeeID,
EmpCalc.SinMar, EmpCalc.NoAllow, EmpCalc.PayRate, EmpCalc.Hours,
EmpCalc.RegPay, EmpCalc.OTRate, EmpCalc.Overtime, EmpCalc.OTPay,
EmpCalc.ExpPayPerDay, EmpCalc.TimeID, EmpCalc.HoursID, EmpCalc.ChkNoID,
EmpCalc.Paid
ORDER BY EmpCalc.[Work Date] DESC , EmpCalc.[Last Name], Time.TimeCounter;
 
Top