select substr(alt_acc_no,1,7) " NBS ",
substr(a.acc_name,1,52) Name,
to_char(decode(b.dr_cr,'C'
substr(user_name,1,9) " USER NAME ",
to_char(f.curbal,'$9,999,9
substr(DESCRIPT,1,10) " TYPE ",
m.proc_date
from save_tran t,
save_acc a,
users u,
save_finl f,
memo_appl m,
base_type b,
altern_acc n
where t.acc_no = a.acc_no
and t.base_code = b.base_code
and a.acc_no = f.acc_no
and t.user_id = u.user_id
and appl_id_a = f.acc_no
and n.acc_no(+) = t.acc_no
and m.memo_code ='REAC'
and tran_code not in ('5','4','24','905','704',
and user_type = 'A'
and deleted is null
and branch not in '06'
and t.user_id not like '%FOREDBA%'
and proc_date between '&proc_date' and '&proc_date'
and date_appl between '&date_appl' and '&date_appl'
and m.proc_date = (select max(q.proc_date)
from memo_appl q
where q.proc_date between '&proc_date' and '&proc_date'
and q.memo_code = m.memo_code
and ..(all other conditions which join q to m))
order by acc_name
/
Main Topics
Browse All Topics





by: sujith80Posted on 2007-03-10 at 09:02:20ID: 18694410
>> date of the latest REAC memo.
,0,tran_am t),'$99,99 9,999.99') "Debit", 99,999.99' ) BALANCE '924','8', '146')
What is the column name that you are referring to? is it proc_date?
The below soln is assuming that you are referring to proc_date, if not change the column name accordingly.
select NBS, name, debit , user_name "USER NAME", balance, type
from (
select
substr(alt_acc_no,1,7) "NBS",
substr(a.acc_name,1,52) Name,
to_char(decode(b.dr_cr,'C'
substr(user_name,1,9) "USER_NAME",
to_char(f.curbal,'$9,999,9
,substr(DESCRIPT,1,10) TYPE ,
row_number() over (order by proc_date)
from save_tran t, save_acc a,users u,save_finl f,memo_appl m
,base_type b,altern_acc n
where t.acc_no = a.acc_no
and t.base_code = b.base_code
and a.acc_no = f.acc_no
and t.user_id = u.user_id
and appl_id_a = f.acc_no
and n.acc_no(+) = t.acc_no
and m.memo_code ='REAC'
and tran_code not in ('5','4','24','905','704',
and user_type = 'A'
and deleted is null
and branch not in '06'
and t.user_id not like '%FOREDBA%'
and proc_date between '&proc_date' and '&proc_date')
and date_appl between '&date_appl' and '&date_appl') )
WHERE proc_date = (select max(proc_date) from <the table name> )
order by acc_name