By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,611 Members | 1,692 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,611 IT Pros & Developers. It's quick & easy.

Time difference from end time of record to now.

P: 72
Hi all,

I have a database that records issues and incidents based on different priorities.

I am trying to write a query to show the time difference since the last incident depending on priority.

I.e. difference between End date/time and Now where priority = 1 and the same where the priority = 2.

What I have so far is:

Datediff: DateDiff("n",[date resolved],Date())

Timediff: DateDiff("n",[time resolved],now())

Total mins: ([timediff]+[datediff])

I am having difficulty in making this work by incorporating the priorites however.

Can this be done?

Thanks
Gareth
Nov 15 '11 #1
Share this Question
Share on Google+
3 Replies


Rabbit
Expert Mod 10K+
P: 12,421
I don't know what you mean. Some sample data would go a long way.
Nov 15 '11 #2

P: 72
I've got it. I made it work by subtracting the time from the Date/Time resolved of the last incident to Now()

I sorted it descending so the latest incident was at the top and then only returned the top 1 row.
Nov 16 '11 #3

NeoPa
Expert Mod 15k+
P: 31,712
That's good thinking Gareth but will cause issues for multiple groups.

What you need to be looking at is a GROUPed query with aggrgates where you use Min() of the value of (Now() - [DateinRecord]) and GROUP BY [Priority].
Nov 17 '11 #4

Post your reply

Sign in to post your reply or Sign up for a free account.