I have a table:

```
ID int
category int
quantity int
timestamp timestamp

```

I want to SELECT id="id#" and return a 'position' which is the sum of quantity for each row that has an earlier timestamp in the same category.

Thanks for your pointers!