Hi,
I am new to this forum and have created a script that pulls data from two files.
The one table has accounting data and the second one has demographic data.
The accounting table is the one with the problem.
I can either get a debit column or I can get all credit columns but not both.
I appologize if this is not the correct place or that the code is too long.
select to_char (SYSDATE, 'MM/DD/YY HH24MI') TODAYS_DATE,
b.ins_co_name,
b.ins_co_address2,
b.ins_co_city,
b.ins_co_state,
b.ins_co_zip,
b.Pat_Lname| |','| |b.Pat_Fname| |' '| |Pat_Middle_Initial Name,
substr(g.cntrl_no,1,10) Claim,
g.trans_cd,
g.entry_date BILL_DATE,
g.trans_date,
SUM( DECODE(substr(g.TRANS_CD,1,2),'01',g.DEBIT_AMOUNT,0)) Billed,
SUM( DECODE(substr( g.TRANS_CD,1,1), 'R', g.CREDIT_AMOUNT, 0)) Payment,
SUM( DECODE(substr( g.TRANS_CD,1,1), 'W', g.CREDIT_AMOUNT, 0)) Adjustments,
SUM( DECODE(substr(g.TRANS_CD,1,1),'U',g.CREDIT_AMOUNT,0)) Jag,
SUM(g.CREDIT_AMOUNT) Totals,
SUM(0) DUMMY
FROM i_arc_general_ledger g,i_arc_permanent_bill b
where g.entry_date between trunc(sysdate) -210 and trunc(sysdate) -120
and g.cntrl_no IN b.cntrl_no
and substr(g.trans_cd,1,2) !='AU'
and b.status = 'OPEN'
group by b.ins_co_name,b.ins_co_address2,b.ins_co_city,b.ins_co_state,b.ins_co_zip,g.cntrl_no,g.debit_amount,
g.credit_Amount,g.trans_cd,g.entry_date,g.trans_date,b.Pat_Lname,b.Pat_Fname,b.Pat_Middle_Initial
having SUM( DECODE(substr( TRANS_CD,1,1), 'U', CREDIT_AMOUNT, 0)) !=0
/
Thanks in advance
I am new to this forum and have created a script that pulls data from two files.
The one table has accounting data and the second one has demographic data.
The accounting table is the one with the problem.
I can either get a debit column or I can get all credit columns but not both.
I appologize if this is not the correct place or that the code is too long.
select to_char (SYSDATE, 'MM/DD/YY HH24MI') TODAYS_DATE,
b.ins_co_name,
b.ins_co_address2,
b.ins_co_city,
b.ins_co_state,
b.ins_co_zip,
b.Pat_Lname| |','| |b.Pat_Fname| |' '| |Pat_Middle_Initial Name,
substr(g.cntrl_no,1,10) Claim,
g.trans_cd,
g.entry_date BILL_DATE,
g.trans_date,
SUM( DECODE(substr(g.TRANS_CD,1,2),'01',g.DEBIT_AMOUNT,0)) Billed,
SUM( DECODE(substr( g.TRANS_CD,1,1), 'R', g.CREDIT_AMOUNT, 0)) Payment,
SUM( DECODE(substr( g.TRANS_CD,1,1), 'W', g.CREDIT_AMOUNT, 0)) Adjustments,
SUM( DECODE(substr(g.TRANS_CD,1,1),'U',g.CREDIT_AMOUNT,0)) Jag,
SUM(g.CREDIT_AMOUNT) Totals,
SUM(0) DUMMY
FROM i_arc_general_ledger g,i_arc_permanent_bill b
where g.entry_date between trunc(sysdate) -210 and trunc(sysdate) -120
and g.cntrl_no IN b.cntrl_no
and substr(g.trans_cd,1,2) !='AU'
and b.status = 'OPEN'
group by b.ins_co_name,b.ins_co_address2,b.ins_co_city,b.ins_co_state,b.ins_co_zip,g.cntrl_no,g.debit_amount,
g.credit_Amount,g.trans_cd,g.entry_date,g.trans_date,b.Pat_Lname,b.Pat_Fname,b.Pat_Middle_Initial
having SUM( DECODE(substr( TRANS_CD,1,1), 'U', CREDIT_AMOUNT, 0)) !=0
/
Thanks in advance