Can I make MSTR do this or something like it?
select y.LOAD_DATE, avg(x.ratio)
from (
select a.LOAD_DATE,b.PRS_LN_ID,(a.total_debt/b.ln_bpo_low_value) ratio
from PRS_TBL_LN_PAYMENT a, PRS_TBL_LN_BPO_DETAILS b
where a.PRS_LN_ID=b.PRS_LN_ID
and a.LOAD_DATE=b.LOAD_DATE
) x,
PRS_TBL_LOAD_PERIOD y
where x.LOAD_DATE=y.LOAD_DATE
group by y.LOAD_DATE
PRS_LN_ID & LOAD_DATE are the primary keys on both tables.
let me know if you need more info...
select y.LOAD_DATE, avg(x.ratio)
from (
select a.LOAD_DATE,b.PRS_LN_ID,(a.total_debt/b.ln_bpo_low_value) ratio
from PRS_TBL_LN_PAYMENT a, PRS_TBL_LN_BPO_DETAILS b
where a.PRS_LN_ID=b.PRS_LN_ID
and a.LOAD_DATE=b.LOAD_DATE
) x,
PRS_TBL_LOAD_PERIOD y
where x.LOAD_DATE=y.LOAD_DATE
group by y.LOAD_DATE
PRS_LN_ID & LOAD_DATE are the primary keys on both tables.
let me know if you need more info...