访问:获取总时间差异和超过设定数量的时间范围

ACCESS: Get total time different and amount of time ranges above a set amount

我有一个 table,我不仅要获取两列之间的时间(小时)差异之和,还要获取时差超过设定值的次数,即 6 in这种情况。

我从 Getting the sum of a datediff result 得到的总数,但我可以在同一个查询中也得到 count(*) where datediff => 6 吗?

在此先感谢您提供的所有帮助。

使用数小时的 DateDiff 可能没有用,因为它将 return 1 小时,比如说 10:55 到 11:03。

所以数分钟:

Select
    *, DateDiff("n", [TimeStart], [TimeEnd]) / 60 As Hours
From 
    YourTable

保存此查询并将其用作新查询中的源以计算小时计数大于或等于六的条目:

Select Count(*) As Entries
From YourQuery
Where Hours >= 6