Master Sketchiggle
Master Sketchiggle

Reputation: 93

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

I have a table that I'm trying to not only get the sum of time(hours) difference between two columns but also the amount of times a time difference is above a set amount, 6 in this case.

The total I got from Getting the sum of a datediff result but can I in the same query also get count(*) where datediff => 6?

Thanks in advance for any and all help.

Upvotes: 0

Views: 89

Answers (1)

Gustav
Gustav

Reputation: 55856

DateDiff used for hours will probably not be useful, as it will return 1 hour from, say 10:55 to 11:03.

So count minutes:

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

Save this query and use it as source in a new query to count those entries with an hour count greater than or equal to six:

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

Upvotes: 1

Related Questions