Created 06-23-2016 01:11 PM
seeing this error while doing inserts
SELECT user_no ,user_name ,ref_date , 'xxx' BRAND ,nvl(SUM ( CASE WHEN product_name = 'xx' AND indicator_name = 'xx' THEN indicator_value ELSE NULL END ),0) AS SB_TO , nvl(SUM ( CASE WHEN product_name = 'xx' AND indicator_name = 'xx' THEN indicator_value ELSE NULL END ),0) AS SB_GW , nvl(SUM ( CASE WHEN product_name = 'xx' AND indicator_name = 'xx' THEN indicator_value ELSE NULL END ),0) AS xx FROM (SELECT pun.user_no , pun.user_name, c.calendar_date AS ref_date , p.xx, p.xx, p.xx, p.channel, i.xx, sum(f.xx) AS indicator_value FROM tabl1 f join tab2 c on f.time_key = c.time_key join tab3 p on f.product_key = p.product_key join tab4 i on f.indicator_key = i.indicator_key join tab5 pun on f.xx = pun.xx GROUP by pun.user_no , pun.user_name, c.calendar_date, p.xx, p.xx, p.xx, p.xx, i.xx) GROUP BY user_no, user_name, ref_date
Created 06-27-2016 07:22 AM
Maybe it's not the only issue, but you have to specify an alias for the subquery. Try doing this and let us know if you have other issues or the same error still remains...