SQL Query Absenteeism Calculation per month

Job ID: 34568262

Budget: €8 – €30 EUR

I am looking for someone to make a query to calculate the total sick leave days of a certain month, for example January.

This is a hard query!!

January has 31 days in total, which means someone can be sick for a maximum of 31 days.

Example:
row 1:
GUID: 2382932
Begin: 1st January 2022
Change: 4 January 2022
End: 20st Janary 2022
Absent percentage: 20%
Contract hours per week: 40 hours.

Row 2:
GUID: 2382932
Begin: 1st January 2022
Change: 10 January 2022
End: 20st Janary 2022
Absent percentage: 40%
Contract hours per week: 40 hours.

Row 3:
GUID: 2382932
Begin: 1st January 2022
Change: 15 January 2022
End: 20st Janary 2022
Absent percentage: 80%
Contract hours per week: 40 hours.

Which should do the following calculation:
Row 1 4 days sick, with absent percentage of 20% -> 0.20 * 40 = 8 hours sick.
Row 2: from 10 January till 20 January 2022. 40% -> 0.40 * 40 = 16 hours sick.
Row 3: from 15 January till 20 January: 80% -> 0.80 * 40 = 32 hours sick.

Total from period 1st of January till 20st of January: 56 hours sick.

This means that one sick leave can have multiple rows in the DB, in this example 3. You need to calculate the hours of sickness. If a sick leave goes from 1st of January till the 20th of March and we want to know the days in March this particular record is only 20 days sick.
In February he is the whole of February sick.

I will provide the SQL table.

Only people that are GOOD and ADVANCED SKILL in SQL.