We Have a swipe machine it will record all the data i.e intime and outimes of employees,I want to get the minimum intime and outime ,I have got it by using min and max functions and by using group by date,but we have Employees who start at evening and work for the next day also ,so my query is failing for these employees,I tried to solve this problem by subtracting 6 and half hours from the time recorded so that the recorded data falls in one date,then i used min and max functions and group by date and finally addedd 6 and half hours to the min and max times then i got all the shifts data also perfectly,but in case there is any shift starting at 6’o clock this query will fail,I want a better solution for this problem can u please help me.