SQL Subqueries
Subject:   accumulate a field
Date:   2006-07-31 07:44:28
From:   kaczmar
Response to: accumulate a field

it doesn't really work for me. It accumulates a record above only... Is there actually a way to accumulate values in sql without using procedures?
Full Threads Newest First

Showing messages 1 through 1 of 1.

  • accumulate a field
    2007-11-15 23:14:04  AdamBerko [View]

    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