cancel
Showing results for 
Search instead for 
Did you mean: 

T-SQL Balance sheet cumulative months query

former_member666435
Participant
0 Kudos
243

Hi all,

I have the query below, i want the result to be all months available in the database in a cumulative way, can someone help me? I should add that i want to use this query in a stored procedure using an input parameter for date.

		Select

		'Assets' as "Group Mask"

		,case when t0.FatherNum = 'A20' then 'AR'

		when t0.FatherNum in ('A40','A50') then 'OCA'

		when t0.FatherNum = 'A90' then 'FA'

		when t0.FatherNum = 'A10' then 'CASH'

		else 'Other' end as "Classification"

		,eomonth(t1.RefDate) as "Date"
		,t0."AcctName" "Account Name"
		,(SUM(t1."Debit") - sum(t1."Credit"))  as Balance

		FROM OACT t0 -- G/L Accounts

		inner join JDT1 t1 ON T0."AcctCode" = T1."Account"

		where t0."GroupMask" = 1
	
		group by

		t0."AcctName"
		,t0.FatherNum 
		,eomonth(t1.RefDate)
		,t1."Credit"
		,t1."Debit"
		,t1."Account"<br>

Accepted Solutions (0)

Answers (0)