July 26, 2002 at 8:36 am
I am a newbee to this and have a question about adding datetime fields to generate uptime and downtime stats on a 24 hour period, then a 7day, one week and one year.
I have a Table that has two fields two help calculate this reporting information- here is a sample snaphot:
sevs TimePointDateTime
------------- ---------------------------
MINOR 2002-07-26 03:01:24.697
OK 2002-07-26 04:06:24.693
MAJOR 2002-07-26 06:11:24.693
MINOR 2002-07-26 08:16:25.203
CRITICAL 2002-07-26 09:21:24.703
The question is how to I calculcate the SEVS from one to another in terms of time. The sevs field can constantly change or stay the same over time. I need to run reports against how long each sev was at that condition, then calculate a percentage of time it was at that sev over time periods.
July 26, 2002 at 12:00 pm
If you are looking for the difference between any two time periods, a subquery and self join with the item just after any item can be calculated. Helps to have a PK, actually, may be required.
basically you query the table and self join back on the time = select min(time) from the self join where time > the time of the first table.
Try this and post someting and we'll help.
Steve Jones
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply