Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个包含日期和时间数据的表格,如下所示。
我想收集上表中粗体的员工/部门/日期/时间窗口明智的最小和最大日期/时间的数据。下表是我想从上表中得出的结果。
是否有任何 SQL 查询选项可用于获取此信息?
提前致谢
您可以使用min,max andgroup by 函数来获得所需的结果:
min,
and
select EmpId,Section,min(EntryTime)MinEntryTime,Max(EntryTime)MaxEntryTime from yourtable group by EmpId,Section