Ok, I have one table that lists activities of hardware. I want to sum the count between activities. Here is my table:
History:
HW | SN | DateTime | Activity | count
--------------------------------------------------
101 | 2 | 5/3/03 11:45:04 PM | 1 | 0
101 | 2 | 5/3/03 11:46:04 PM | 0 | 25
101 | 2 | 5/3/03 11:47:04 PM | 0 | 34
101 | 2 | 5/3/03 11:48:04 PM | 0 | 46
101 | 2 | 5/3/03 11:49:04 PM | 1 | 0
101 | 2 | 5/3/03 11:50:04 PM | 0 | 57
101 | 2 | 5/3/03 11:51:04 PM | 0 | 68
101 | 2 | 5/3/03 11:52:04 PM | 1 | 0
105 | 1 | 5/3/03 11:53:04 PM | 1 | 0
105 | 1 | 5/3/03 11:54:04 PM | 0 | 43
105 | 1 | 5/3/03 11:55:04 PM | 1 | 0
What I want is to add the count between teh activities of "0" so my output would be like this.
HW | SN | DateTime | Activity | count
--------------------------------------------------
101 | 2 | 5/3/03 11:45:04 PM | 1 | 0
101 | 2 | 5/3/03 11:49:04 PM | 1 | 105
101 | 2 | 5/3/03 11:52:04 PM | 1 | 125
105 | 1 | 5/3/03 11:53:04 PM | 1 | 0
105 | 1 | 5/3/03 11:55:04 PM | 1 | 43
I know that a subquery is needed I just can't figure out how to add the fields.
Thanks
History:
HW | SN | DateTime | Activity | count
--------------------------------------------------
101 | 2 | 5/3/03 11:45:04 PM | 1 | 0
101 | 2 | 5/3/03 11:46:04 PM | 0 | 25
101 | 2 | 5/3/03 11:47:04 PM | 0 | 34
101 | 2 | 5/3/03 11:48:04 PM | 0 | 46
101 | 2 | 5/3/03 11:49:04 PM | 1 | 0
101 | 2 | 5/3/03 11:50:04 PM | 0 | 57
101 | 2 | 5/3/03 11:51:04 PM | 0 | 68
101 | 2 | 5/3/03 11:52:04 PM | 1 | 0
105 | 1 | 5/3/03 11:53:04 PM | 1 | 0
105 | 1 | 5/3/03 11:54:04 PM | 0 | 43
105 | 1 | 5/3/03 11:55:04 PM | 1 | 0
What I want is to add the count between teh activities of "0" so my output would be like this.
HW | SN | DateTime | Activity | count
--------------------------------------------------
101 | 2 | 5/3/03 11:45:04 PM | 1 | 0
101 | 2 | 5/3/03 11:49:04 PM | 1 | 105
101 | 2 | 5/3/03 11:52:04 PM | 1 | 125
105 | 1 | 5/3/03 11:53:04 PM | 1 | 0
105 | 1 | 5/3/03 11:55:04 PM | 1 | 43
I know that a subquery is needed I just can't figure out how to add the fields.
Thanks