Skip to content
Advertisement

Update table data, fetched from another table

I have a table which is storing the attendance information on an employee and another table that’s storing the information about the shift of the employee which is basically a duty roster.

Here is the structure to attendance table

Here is the structure and sample data for Duty roster.

The idea is to update the ShiftCode in Attendance table wrt to the shifts stored in the duty roster. So if the attendance for employee 1 is between '2019-09-01' and '2019-09-05' then the shift code for this employee should be updated to 24 and same for other employee. If the duty roster does not exist for the dates present in attendance table it should not update it and let it the way it is. I need an update query.

Advertisement

Answer

Something like this:

and with update:

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement