I want to select date between time in sql
i have a table called temp,records of temp shown below
empid | attendencedate |
1 | 04-01-17 08:45:12 |
1 | 04-01-17 12:45:12 |
1 | 04-01-17 16:45:12 |
2 | 04-01-17 08:45:12 |
2 | 04-01-17 18:45:12 |
in above table employee 1 punched 3 times for a day
if employee punched morning 8 am upto 10 am means at that minimum punch is intime
if employee punched evening greater than 5 pm means maximum of punching as outtime
my expected result is
empid | intime | outtime |
1 | 04-01-17 08:45:12 | 04-01-17 16:45:12 |
2 | 04-01-17 08:45:12 | 04-01-17 18:45:12 |