Hi I have the following query and I am endeavouring to add further columns but it keeps failing could someone be kind enough to show me how? I keep getting outer failures so I am guessing I am inserting the requests in the wrong place.
I want to add cus_email, cus_hometel, cus_worktel, cus_mobile, (in table "Customer") 7 con_brokref (in Table "contract")
select cus_id, con_polid, cus_surname, cus_forename1, con_renewal, con_type,
(r_premium1.12), r_charge, r_legalexp, (case when r_insr_charge is null then 0 else r_insr_charge end),
(case when sum((ba1.bad_premium1.12)) is null then 0 else sum((ba1.bad_premium1.12)) end) RnwlAddon,
(case when ar_premium is null then 0 else (ar_premium1.12) end),
(case when ar_charge is null then 0 else ar_charge end),
(case when ar_legalexp is null then 0 else ar_legalexp end),
(case when ar_insr_charge is null then 0 else ar_insr_charge end),
(case when sum((ba2.bad_premium1.12)) is null then 0 else sum((ba2.bad_premium1.12)) end) AltAddon,
ad.add_address1, ad.add_address2, ad.add_address3, ad.add_address4, ad.add_postcode,
(case when con_lob = "HHI" then ha.add_address1 else (case when ca.add_id is null then ad.add_address1 else ca.add_address1 end) end),
(case when con_lob = "HHI" then ha.add_address2 else (case when ca.add_id is null then ad.add_address2 else ca.add_address2 end) end),
(case when con_lob = "HHI" then ha.add_address3 else (case when ca.add_id is null then ad.add_address3 else ca.add_address3 end) end),
(case when con_lob = "HHI" then ha.add_address4 else (case when ca.add_id is null then ad.add_address4 else ca.add_address4 end) end),
(case when con_lob = "HHI" then ha.add_postcode else (case when ca.add_id is null then ad.add_postcode else ca.add_postcode end) end),
veh_reg, veh_man_name, veh_model_name
from customer, address ad, contract, renewals, outer (broker_addon ba1),
outer (alt_renewals, outer(broker_addon ba2)),
risk_history, outer (cover, outer (address ca)),
outer(hh_risk_history, hh_premise, outer(address ha)),
outer(master_vehicle, vehicle_details)
where con_cus_id = cus_id
and ad.add_id = cus_add_id
and rsh_con_id = con_id
and rsh_cov_id = cov_id
and hpr_id = hrk_hpr_id
and hrk_rsh_id = rsh_id
and hpr_add_id = ha.add_id
and cov_add_id = ca.add_id
and con_polid> 0
and con_status = 4
and ba1.bad_con_id = con_id
and ba1.bad_type = "R"
and r_con_id = con_id
and ar_con_id = r_con_id
and ba2.bad_con_id = ar_alt_con_id
and ba2.bad_type = "C"
and rsh_mvh_id = mvh_id
and veh_mvh_id = mvh_id
group by 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29
order by 1, 2