嗨,我有这张table,可以节省入场的员工
IO_Id Employee_Id EnterDate EnterTime ExitDate ExitTime
--------------------------------------------------------------------------
1 1 11/20/2018 08:00 11/20/2018 09:00
2 1 11/20/2018 09:10 11/20/2018 09:20
3 1 11/20/2018 09:30 11/20/2018 10:00
4 2 11/20/2018 09:30 11/20/2018 11:00
5 1 11/21/2018 10:00 11/21/2018 11:30
如何选择任何一行的所有日期和所有员工都有firstentertime、fistexittime、lastentertime、lastexittime的结果
IO_Id Employee_Id EnterDate firstEnterTime fistExitTime LastEnterTime LastExitTime
----------------------------------------------------------------------------------------------------------
1 1 11/20/2018 08:00 09:00 09:30 10:00
4 2 11/20/2018 09:30 11:00 09:30 11:00
5 1 11/21/2018 10:00 11:30 10:00 11:30
1条答案
按热度按时间gjmwrych1#
您可以在下面尝试使用min()和max()聚合