I have a table with the following structure (Occurrence Table):
ID EmployeeID DateOfOccurrence
--------------------------------------
1 999999 2017-02-14
2 999999 2017-03-02
3 999999 2017-03-23
4 999999 2017-05-10
I would like to create a query to return the result (grouped by employeeid):
999999 2017-02-14 to 2017-03-02 16 days
999999 2017-03-02 to 2017-03-23 21 days
999999 2017-03-23 to 2017-05-10 48 days
999999 2017-05-10 to <today> xx days
* <today> = current day (i.e., getdate())
Thank you for your help in advance.