running-total

SQL query for cumulative frequency of list of datetimes

I have a list of times in a database column (representing visits to a website). I need to group them in intervals and then get a 'cumulative frequency' table of those dates. For instance I might have: 9:01 9:04 9:11 9:13 9:22 9:24 9:28 and i want to convert that into 9:05 - 2 9:15 - 4 9:25 - 6 9:30 - 7 How can I do that? Can i ev...

Running total by grouped records in table

Hi all, I have a table like this (Oracle, 10) Account Bookdate Amount 1 20080101 100 1 20080102 101 2 20080102 200 1 20080103 -200 ... What I need is new table grouped by Account order by Account asc and Bookdate asc with a running total field, like this: Acc...

Calculate a Running Total in SqlServer

Imagine the following table (called TestTable): id somedate somevalue -- -------- --------- 45 01/Jan/09 3 23 08/Jan/09 5 12 02/Feb/09 0 77 14/Feb/09 7 39 20/Feb/09 34 33 02/Mar/09 6 I would like a query that returns a running total in date order, like: id somedate somevalue ...

Calculated control on subform based on current record

I have the following: main form "customer" from a "customer" table. subform "invoices" with fields "invoice date", "invoice amount" "customer id" etc. from a table "invoices" whenever user clicks or goes to a record in the "invoices" sub form. I would like a "total so far" control to calculate the sum of the "invoices amount" up until t...

Improve SQL query: Cumulative amounts over time

Suppose I have a SQL table of Awards, with fields for Date and Amount. I need to generate a table with a sequence of consecutive dates, the amount awarded in each day, and the running (cumulative) total. Date Amount_Total Amount_RunningTotal ---------- ------------ ------------------- 1/1/2010 100 ...

Can somebody explain the running total and SQL self-join in this tutorial to me?

I was reading over the tutorial here: http://www.1keydata.com/sql/sql-running-totals.html and it all made sense until it suddenly got extremely ridiculously unbelievably complicated when it got to rank, median, running totals, etc. Can somebody explain in plain English how that query results in a running total? Thanks! ...

Oracle(10) SQL: calculating final sum depending on two field

First the disclaimer: I never learnt any programming in school, and just have to deal with various SQL problems (too). So now I've got two tables, TABLE1: ACCNO BAL1 BAL2 11111 20 10 And TABLE2 (which has the ACCNO key, of course) related rows to '11111': DATENUM AMT 1 -5 2 -10 3 8 4 -23 5 100 6 ...

SQL select row-wise increase in amount of running total column

Suppose I have a table with columns (DayId, RunningTotal): DayId RunningTotal --------------------- 1 25 3 50 6 100 9 200 10 250 How can I select the DayId and the amount the RunningTotal has increased from the previous day? i.e. how can I select: DayId DayTotal --------------------- 1 2...

SQL Audit Log Running Totals

I have a table with an audit log: BugId Timestamp Status 1 2010-06-24 10:00:00 open 2 2010-06-24 11:00:00 open 1 2010-06-25 12:00:00 closed 2 2010-06-26 13:00:00 closed I want a running total of open and closed bugs like: Timestamp # Status 2...

List comprehension for running total

I want to get a running total from a list of numbers. For demo purposes, I start with a sequential list of numbers using range a = range(20) runningTotal = [] for n in range(len(a)): new = runningTotal[n-1] + a[n] if n > 0 else a[n] runningTotal.append(new) # This one is a syntax error # runningTotal = [a[n] for n in range(le...

How to create a "meter bar" in Flash?

I am trying to create a "meter bar" in Flash. I am creating an interactive house in Flash. Inside the house are objects that consume power. (ie. light bulb, computer, stove, etc...) Those objects are toggle buttons (created using MovieClips). (The objects can be toggled ON/OFF.) When ON--there is a "power value" associated with each hous...

SQLite: accumulator (sum) column in a SELECT statement

Hi, I have a table like this one: SELECT value FROM table; value 1 3 13 1 5 I would like to add an accumulator column, so that I have this result: value accumulated 1 1 3 4 13 17 1 18 5 23 How can I do this? What's the real name of what I want to do? Thanks ...