-2

I have this data. Can someone help how can I combine them into one?

id  employeeID   date         timein    timeout     timein1     timeout1
1   12286        2016-09-10   08:08:00  00:00:00    00:00:00    00:00:00
2   12286        2016-09-10   00:00:00  12:08:32    00:00:00    00:00:00
3   12286        2016-09-10   00:00:00  00:00:00    12:41:54    00:00:00
4   12286        2016-09-10   00:00:00  00:00:00    00:00:00    17:10:05
5   12286        2016-10-10   07:41:05  00:00:00    00:00:00    00:00:00
6   12286        2016-10-10   00:00:00  12:15:00    00:00:00    00:00:00
7   12286        2016-10-10   00:00:00  00:00:00    12:35:15    00:00:00
8   12286        2016-10-10   00:00:00  00:00:00    00:00:00    17:15:15

This is the output that I wanted. Help me. Thanks

id  employeeID   date         timein    timeout     timein1     timeout1
1   12286        2016-09-10   08:08:00  12:08:32    12:41:54    17:10:05
2   12286        2016-10-10   07:41:05  12:15:00    12:35:15    17:15:15
Strawberry
  • 33,750
  • 13
  • 40
  • 57

2 Answers2

0

If it was me, I'd probably adopt a schema roughly as follows:

id  employeeID   datetime             activity
1   12286        2016-09-10 08:08:00  in 
2   12286        2016-09-10 12:08:32  out  
3   12286        2016-09-10 12:41:54  in
4   12286        2016-09-10 17:10:05  ...
Strawberry
  • 33,750
  • 13
  • 40
  • 57
0

A temporary solution without field: id

select employeeID, date, max(timein), max(timeout), max(timein1), max(timeout1) group by employeeID, date

Better revise the Insert query to null for 00:00:00 instead