Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Development - SQL Server 2014 » Latest topics
Viewing all articles
Browse latest Browse all 3145

Find "Consecutive" records based on available dates in another table

$
0
0
I have an activity that happens each Mon, Wed, and Friday, except holidays. I have a table that stores all of the appropriate dates. Since this only happens M-W-F, I consider 05-04-2016, 05-06-2016, and 05-09-2016 "consecutive".The appropriate dates are stored in a table just for this purpose. Like thisADate Holiday Description07-01-2016 0 NULL07-04-2016 1 July 4th07-06-2016 0 NULLI have another table that tracks employee participation. It has a field for date, and a field for the employee ID.ADate EmployeeID07-01-2016 123407-01-2016 567807-06-2016 123407-08-2016 1234At the end of a two-month period, I want to determine which employee participated in the most "consecutive" opportunities. In the above case, employee 5678 = 1 and employee 1234 = 3.

Viewing all articles
Browse latest Browse all 3145

Trending Articles