running-total

MongoDB running total like aggregation of previous records up until occurrance of value

ぃ、小莉子 提交于 2019-12-24 10:00:36
问题 I am currently dealing with a set of in-game-events for various matches. In the game it is possible to kill enemies and purchase items in a shop. What I have been trying to do right now, is to count the number of kills that have occured in a single match up until every purchasing event. { "_id" : ObjectId("5988f89ae5873exxxxxxx"), "gameId" : NumberLong(2910126xxx) "participantId" : 3, "type" : "ITEM_PURCHASED", "timestamp" : 656664 }, { "_id" : ObjectId("5988f89ae5873exxxxxxx"), "gameId" :

SSAS MDX Calculate running total but exclude less significant rows

陌路散爱 提交于 2019-12-24 03:19:16
问题 Old SQL developer, new to MDX: Need help with a requirement to include small totals in a running total but not show the contributing rows of those small totals. Consider this data Amount Running Total Denver 6,321 6,321 Portland 8,426 14,747 Boise 19,222 33,969 Helena 23,257 57,226 Bozeman 31,225 88,451 Seattle 36,894 125,345 My requirement is to not show any amounts under 15,000 but instead show the running total that includes them. I must not show amounts or running totals less than 15,000.

mysql query uses every row of another query

房东的猫 提交于 2019-12-22 09:08:20
问题 I have searched a lot, but cannot find a helpful answer: i want to have a list of totals from a period the user defines by giving me a start and end date. The totals should every time being from the start date to beginning with the start date and add every row 1 day. so the last row gives the totals from start to end date. example: - given period = start 2013-01-01 , end = 2013-01-31 total day 1 = 100 total day 2 = 0 (not listed in my totalsperday query, but should have a row in my final

Select running balance from table credit debit columns

谁说胖子不能爱 提交于 2019-12-22 00:49:48
问题 I have a SQL Server 2008 table, and I need to select a running balance from it TransDate Credit Debit Datasource ------------------------------------------ 2014-01-01 5000 NULL 3 2014-01-07 NULL 2000 3 2014-01-11 5000 NULL 3 2014-02-03 6000 NULL 4 2014-02-06 NULL 4000 4 2014-02-11 3000 NULL 4 2014-02-21 NULL 1000 3 2014-02-28 2000 NULL 3 2014-03-01 5000 NULL 3 I tried a correlated query Select t.TransDate, t.Credit, t.Debit, (Select sum(coalesce(x.credit, 0) - coalesce(x.debit, 0)) From

accumulated sum in query

被刻印的时光 ゝ 提交于 2019-12-21 20:46:46
问题 How is it possible to return rows with an accumulate sum for a row bigger or smaller than a specified value? table: id | count ----------- 1 | 30 2 | 10 3 | 5 4 | 20 5 | 15 query: SELECT id, count FROM table ORDER BY id HAVING SUM(count) < 50 return rows: id | count ------------- 1 | 30 2 | 10 3 | 5 update code: public function query(){ switch($this->table){ case 'in_stock': return "SELECT * FROM ".Init::$static['db'].".stock WHERE id<=dynaccount.stock_first_available_id(".$this->value['num

Retrieve running-total record growth over time in mysql

陌路散爱 提交于 2019-12-21 20:02:21
问题 I have a Drupal site which has a table that keeps track of users. What I want to do is graph membership growth over time. So I want to massage mysql into returning something like this: date | # of users (total who have registered up to the given date) 1/1/2014 | 0 1/2/2014 | 2 1/3/2014 | 10 Where '# of users' is the total number of users that have registered accounts up to the given date (running-total)--NOT the number of users who registered on that particular day (which is trivial to

Running Total C#

对着背影说爱祢 提交于 2019-12-20 07:40:05
问题 I'm creating a donation application that reads the input in a textbox, converts it to a double. Then using the method operatingCost , it should take that converted double and divide it by 17% (operating fees). Currently in the method, I have the variable dontationBFees coming in and then being divided by 17 and creating a new variable afterFees . Everything is working fine but I need to create a running total that will save all of the donations. It should display the total amount raised for

Running Total C#

末鹿安然 提交于 2019-12-20 07:39:05
问题 I'm creating a donation application that reads the input in a textbox, converts it to a double. Then using the method operatingCost , it should take that converted double and divide it by 17% (operating fees). Currently in the method, I have the variable dontationBFees coming in and then being divided by 17 and creating a new variable afterFees . Everything is working fine but I need to create a running total that will save all of the donations. It should display the total amount raised for

Select running total until specific SUM is reached

人盡茶涼 提交于 2019-12-19 03:44:14
问题 I am trying to select the first n rowid values from the following table variable that will get me as close to a sum(itemcount) of 200,000 without crossing that threshhold. If I was looking at this manually, I would just take the top 3 rows. I do not want to use a cursor unless there is no pure-set-based way. What is a good set-based way to get all of the rowid values "sum while/until" I get to a running total of 200,000? I looked at "running totals" at http://www.1keydata.com/sql/sql-running

Running Total by Group SQL (Oracle)

拥有回忆 提交于 2019-12-19 03:15:42
问题 I have a table in an Oracle db that has the following fields of interest: Location, Product, Date, Amount. I would like to write a query that would get a running total of amount by Location, Product, and Date. I put an example table below of what I would like the results to be. I can get a running total but I can't get it to reset when I reach a new Location/Product. This is the code I have thus far, any help would be much appreciated, I have a feeling this is a simple fix. select a.*, sum