Questions tagged [running-totals]
The running-totals tag has no usage guidance.
56
questions
0
votes
2
answers
9k
views
Sql getting debit, credit and balance issue
I am using the query below to get Debit/Credit Balance from table statement
SELECT t.[InvoiceID], t.S_Type as Type,
t.Date, t.Debit, t.Credit, b.Balance
FROM Statement as t CROSS apply
...
1
vote
0
answers
941
views
How to find consecutive count last 3 months count and last 6 months counts
Column names: Site_key. Billing_date ,Reason_type
Things to Find:
Consecutive count for last 5 months:
Last 3 month Count
Last 6 month Count
I have to find Consecutive count for last 5 months for a ...
4
votes
3
answers
2k
views
Running Total: To store or compute
Say I have a product table with the following columns:
product
--------
product_id
name
And I have another table to record the transaction (IN/OUT) for each product
product_transaction
-------------...
0
votes
1
answer
215
views
Merging two Select queries with different where statements
I have this query below in which I am trying to get results for the month and year to date (account balance).
SELECT T3.AcctCode, T3.AcctName, SUM(T1.Debit - T1.Credit)* -1 AS 'Balance'
FROM OJDT T0
...
1
vote
3
answers
9k
views
Building year to date aggregations using SQL
I need some help with building a monthly aggregation using only SQL.
Imagine the following table:
TranID DateCode Account Value
1 20140101 1 5
2 20140106 1 -3
3 ...
2
votes
3
answers
4k
views
Rolling count of total transactions over time
I need to get a set of total transactions over time on a weekly interval. Essentially I need a total-transactions-to-date column. When I group by WEEK(Date) I get the amount of transactions for that ...