>I need to find the average "check-in time" of an employee with a month period.
>The check-in date is stored in datetime field.
>How can I calculate the average?
select EmployeeID, avg(CheckInTime) as Avg_CheckInTime from CheckIns where CheckInTime between @StartOfTheMonth and @EndOfTheMonth group by EmployeeID
Pass a month number and calculate the @Start and @End dates.
See
http://www.sql-server-helper.com/functions/get-last-day-of-month.aspx (for example) of how to get first and last date of the month.
If it's not broken, fix it until it is.
My Blog