In the table there are dates of visits and change, 1st and 2nd, on some days there may be several entries, some of them are not. you need to display all days of the selected month with the number of records for each day, separate requests for each shift, if there are no visits on a particular day, set 0
date daytime 01.04.19 1 01.04.19 1 01.04.19 2 03.04.19 1 03.04.19 2
....
should happen
for the 1st shift
01.04.19 - 2 02.04.19 - 0 03.04.19 = 1
.... Until the end of the month
for the 2nd shift
01.04.19 - 1 02.04.19 - 0 03.04.19 - 1
... etc.