GL Trial Balance Query
Jump to navigation
Jump to search
select GL_Account Account,Description Name, (select sum(gta.trx_amount) from glttrx gta where ga.gl_account=gta.gl_account and gta.trx_date between :PD_Beg_Date and :PD_End_Date and gta.trANS_type<>'B') Cur_Pd_Amt, (select sum(gta.trx_amount) from glttrx gta where ga.gl_account=gta.gl_account and gta.trx_date <= :PD_End_Date and gta.trANS_type<>'B') End_Amt from gltacct ga where ga.account_type='B' group by gl_account,Description union select GL_Account Account,Description Name, (select sum(gta.trx_amount) from glttrx gta where ga.gl_account=gta.gl_account and gta.trx_date between :PD_Beg_Date and :PD_End_Date and gta.trANS_type<>'B') Pd_Amt, (select sum(gta.trx_amount) from glttrx gta where ga.gl_account=gta.gl_account and gta.trx_date between :yr_Beg_Date and :PD_End_Date and gta.trANS_type<>'B') End_Amt from gltacct ga where ga.account_type='I' group by gl_account,Description
With Begin Amt column:
select GL_Account Account,Description Name, (select sum(gta.trx_amount) from glttrx gta where ga.gl_account=gta.gl_account and gta.trx_date <:PD_beg_Date and gta.trANS_type<>'B') "Begin Amt", (select sum(gta.trx_amount) from glttrx gta where ga.gl_account=gta.gl_account and gta.trx_date between :PD_Beg_Date and :PD_End_Date and gta.trANS_type<>'B') "Current", (select sum(gta.trx_amount) from glttrx gta where ga.gl_account=gta.gl_account and gta.trx_date <= :PD_End_Date and gta.trANS_type<>'B') "Ending Amt" from gltacct ga where ga.account_type='B' group by gl_account,Description union select GL_Account Account,Description Name, (select sum(gta.trx_amount) from glttrx gta where ga.gl_account=gta.gl_account and gta.trx_date between :yr_Beg_Date and (-1 + :PD_beg_Date) and gta.trANS_type<>'B') BeginAmt, (select sum(gta.trx_amount) from glttrx gta where ga.gl_account=gta.gl_account and gta.trx_date between :PD_Beg_Date and :PD_End_Date and gta.trANS_type<>'B') Pd_Amt, (select sum(gta.trx_amount) from glttrx gta where ga.gl_account=gta.gl_account and gta.trx_date between :yr_Beg_Date and :PD_End_Date and gta.trANS_type<>'B') End_Amt from gltacct ga where ga.account_type='I' group by gl_account,Description