Women in Technology

Hear us Roar



Article:
  SQL Subqueries
Subject:   accumulate a field
Date:   2007-11-15 23:14:04
From:   AdamBerko
Response to: accumulate a field

Here is how I did it. Seems to work fine
select ObjectID,StartDate,cscfActiveUsers,
(
select sum(cscfActiveUsers)
from cscf_data b
where b.StartDate<=a.StartDate
and a.ObjectID=b.ObjectID
) as summ
from cscf_data a
order by ObjectID