-
sql script - need help
i need to write a script that figures out the total number of minutes for a specfic event and then add all of the minutes together for each record where "system" = 'aix004'. see below for an example of the table layout.
tablename = uptimeEvent
system_name..............event_begin.............. .......event_end
aix004........................10/10/2005 2:00:00 am.....10/10/2005 2:50:00 am
aix003........................10/11/2005 4:00:00 am.....10/10/2005 4:05:00 am
aix004........................10/12/2005 2:00:00 am.....10/10/2005 2:30:00 am
aix004........................10/13/2005 2:00:00 am.....10/10/2005 2:20:00 am
i wrote the first part to figure out the total number of minutes for each record.
select datediff(mi, event_begin, event_end) as foo
from uptimeevent
now i need to aggregate the three records to calculate the total number of minutes which would equal 100 minutes.
-
select Sum (datediff(mi, event_begin, event_end)) as foo
from uptimeevent
where system_name = 'aix004'
group by system_name
-
thanks andi_g69!!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|