All,
Have an account balance table with fiscal year and period. Need to create a trail balance file from this table. All I have to do is add all debits then all credits for the account from the beginning of time to the specified month, there is the problem.
Cause the there is a (fiscal year) and (period) field I have to interrogate both on the same record so see if I want to include the data. How do I do this? With an inner select?
An example of what I have so far:
SELECT ACCOUNT_ID, sum(DEBIT_AMOUNT) as DebitSum,
sum(CREDIT_AMOUNT) as CreditSum, sum(DEBIT_AMOUNT) - sum(CREDIT_AMOUNT) as Result
From ACCOUNT_BALANCE
Where (ACCOUNT_ID = '253556891')
And (Acct_Year = '2006' And Acct_Period <= '4') And
Group by Account_id
Have an account balance table with fiscal year and period. Need to create a trail balance file from this table. All I have to do is add all debits then all credits for the account from the beginning of time to the specified month, there is the problem.
Cause the there is a (fiscal year) and (period) field I have to interrogate both on the same record so see if I want to include the data. How do I do this? With an inner select?
An example of what I have so far:
SELECT ACCOUNT_ID, sum(DEBIT_AMOUNT) as DebitSum,
sum(CREDIT_AMOUNT) as CreditSum, sum(DEBIT_AMOUNT) - sum(CREDIT_AMOUNT) as Result
From ACCOUNT_BALANCE
Where (ACCOUNT_ID = '253556891')
And (Acct_Year = '2006' And Acct_Period <= '4') And
Group by Account_id