I am new to Access and SQL but I have been playing around and learning as I go.
I have a table of start times and a table of Employee Start Times. The Employee Start Times are fixed.
I am trying to match the Employee Start Times to the start times. I can return the exact matches but I want to be able to use a variance of 30 minutes before Employee Start Time and 45 minutes after.
I cannot find a way of getting the query to match with this variance.
Without knowing the structure of your tables it is hard to write a query, but the idea would be something like shown below. This is for SQLServer, will not work in Access
SELECT
e.EmployeeStartTime,
s.ApproximateStartTime
FROM
EmployeeStartTimeTable AS e
OUTER APPLY
(
SELECT TOP (1) StartTime AS ApproximateStartTime
FROM
StartTimeTable s
ORDER BY
ABS(DATEDIFF(mi,s.StartTime,e.EmployeeStartTime))
) AS s