I have requested the addition of a new field to a table for a report, however the field was added to what I believe was the “wrong table”, because the logic to get the results I need is to add the following to the Universe: The issue is that this has to be replicated 6 times because for each result the join is different. This would require I believe 6 “derived tables”, which I do not believe is the correct route. I need to make an arguement to have the field added to the correct table and the logic done at the source. Gen Count is the field and all the data for the report is coming from s_mlm_payouts mp, however the field was added to f_mlm_cust_genea_hist cg. Please Help
SELECT DECODE (x.gen_cnt, 0, 0, x.total_rv), x.gen_cnt
FROM (SELECT SUM (mp.rv) total_rv,
cg.gen_cnt
FROM s_mlm_payouts mp,
f_mlm_cust_genea_hist cg
WHERE mp.nrvp_first_gen_id = 10005937
AND mp.nrvp_first_gen_id = cg.consultant_cid
AND mp.payout_date = TO_DATE ('1-MAR-2010')
AND cg.payclass = 5
AND cg.period = '201002'
GROUP BY cg.gen_cnt) x
marissa (BOB member since 2010-03-02)