MS AccessJet SQL - staff clock in & out times, same table, sum full time worked per staff
MS AccessJet SQL - staff clock in & out times, same table, sum full time worked per staff I have the below table named 'timings'. It holds the comings and goings of staff members (morn_in, morn_out, afternoon_in, afternoon_out). timings table What I would like to achieve is an output grouped by staff_ref, SUM of their hours worked, like so; staff_ref| total_worked| U1 18:00 I currently use 4 separate queries to select each of the 'type' (morn_in, morn_out etc), the one for type='morn_in' is below, this query is called [101 am in] (it gets referenced later); SELECT staff_ref , time , Format([date],"dd/mm/yyyy") AS t_date FROM timings WHERE (((type)='morn_in')); I then SUM the DateDiff between the morning times; SELECT [101 am in].staff_ref , Sum(DateDiff("n",[101 am in].[time],[102 am out].[time])) AS morning_mins FROM [101 am in] INNER JOIN [102 am out] ON ([101 am in].staff_ref = [102 am out].staff_ref) AND ...
