SELECT qrr.name, qrr.groupid, Count(groupid) AS [Count]
FROM qrydetailsRosterRec qrr
GROUP BY qrr.name, qrr.groupid;
In the above query I have the Count how many times an Employee between two given dates does a specific GroupID.
is there a way to count how many consecutive days the employee does GroupID=1 after their last GroupID NOT IN 1?
08/12/13 Jo, Bloggs Group=1
09/12/13 Jo, Bloggs Group=2
10/12/13 Jo, Bloggs Group=1
11/12/13 Jo, Bloggs Group=1
12/12/13 Jo, Bloggs Group=1
in the above scenario the consecutive count would be 3 as only the last 3 are group=1