Skip to content
Advertisement

How do i group the time in and time out according to the employee number and date [closed]

attendence sql file[ ][2] I try to get attendance table data (which include the emp_no ,date ,time).i want insert the above table date as emp_no,date,time in and time out.time logic is show in below.

i try sql query

Output of above query

Expected output.

how do i fixed this issue? how do i avoid NULL value coming?

Advertisement

Answer

Your sample results don’t make sense. You have duplicates for 23/'2019-08-01', but I see no data supporting such a duplicate.

I suspect that what you really want is aggregation, something like this:

This assumes at most two rows per date per enrollee.

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