Questions tagged [running-totals]
The running-totals tag has no usage guidance.
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 ...
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 ...
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 -------------...
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 ...
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 ...
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 ...