Women in Technology

Hear us Roar



Article:
  SQL Subqueries
Subject:   accumulate a field
Date:   2006-04-05 21:30:05
From:   paul21_7
Response to: accumulate a field

SELECT date,
qty,
(
(SELECT qty
FROM table b
WHERE b.date = (a.date - 1))
+ qty
) tqty
FROM table a


Syntactically its fine ... I made a small assumption on date being the incremental field, so just alter to suit


enjoy

Main Topics Oldest First

Showing messages 1 through 1 of 1.

  • accumulate a field
    2006-07-31 07:44:28  kaczmar [View]

    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?