I have a table which outputs this example data, but for many users and different date ranges:-
Users..........Date..............Hours
John Smith.....Thu 02-JAN-2020...8
John Smith.....Fri 03-JAN-2020...8
John Smith.....Mon 06-JAN-2020...8
John Smith.....Tue 07-JAN-2020...8
John Doe.......Fri 03-JAN-2020...8
John Doe.......Mon 06-JAN-2020...8
John Doe.......Tue 07-JAN-2020...8
John Doe.......Wed 08-JAN-2020...8
Result should read:
Users.............Date........................Hours <br/>
John Smith.....Thu 02-JAN-2020...8 <br/>
John Smith.....Fri 03-JAN-2020...8 <br/>
John Smith.....Sat 04-JAN-2020...0 MISSING WEEKEND <br/>
John Smith.....Sun 05-JAN-2020...0 MISSING WEEKEND <br/>
John Smith.....Mon 06-JAN-2020...8 <br/>
John Smith.....Tue 07-JAN-2020...8 <br/>
John Doe.......Fri 03-JAN-2020...8 <br/>
John Doe.......Sat 04-JAN-2020...0 MISSING WEEKEND <br/>
John Doe.......Sun 05-JAN-2020...0 MISSING WEEKEND <br/>
John Doe.......Mon 06-JAN-2020...8 <br/>
John Doe.......Tue 07-JAN-2020...8 <br/>
John Doe.......Wed 08-JAN-2020...8
I require a query to include the missing weekends, Name and Hours of zero (as DBA will not change the structure of the table and add the weekends).
Have looked at CTE's (Recursives), CROSS JOINS, linking a calendar table, but cannot get this to work