Hi
I building an SQL that retrives data from a lot of tables.
But one of the identifiers is not always there, giving me a lot of problem.
ex1 - this works as long as g.p_number_import_seq existe, witch is not all the time.
I've tried using left join, witch is quite new to me, and I can't really get it to work.
Something like this
All I want is to have an empty field if the field is empty.
Regards
Lars
I building an SQL that retrives data from a lot of tables.
But one of the identifiers is not always there, giving me a lot of problem.
ex1 - this works as long as g.p_number_import_seq existe, witch is not all the time.
Code:
select c.campaign_id, d.birth_date, d.first_name,d.last_name, d.company_name,
d.party_id , d.address_id, d.kob, d.cvr, e.sim_no, e.sim_order_type, f.phone_number
from ol_p_gsm_create a, ol_p_nd_create b, campaign c, contact_info d, p_sim e, p_number f, p_number_import f
where a.order_line_id = '3860089'
and a.order_line_id =B.ORDER_LINE_ID
and b.campaign_seq=c.campaign_seq
and b.contact_info_seq=d.contact_info_seq
and a.p_sim_seq = e.p_sim_seq
and b.p_number_seq=f.p_number_seq
and a.p_number_import_seq = g.p_number_import_seq
I've tried using left join, witch is quite new to me, and I can't really get it to work.
Something like this
Code:
select c.campaign_id, d.birth_date, d.first_name,d.last_name, d.company_name,
d.party_id , d.address_id, d.kob, d.cvr, e.sim_no, e.sim_order_type, f.phone_number
from ol_p_gsm_create a, ol_p_nd_create b, campaign c, contact_info d, p_sim e, p_number f
left join p_number_import g on a.p_number_import_seq = g.p_number_import_seq
where a.order_line_id = '3866031'
and a.order_line_id =B.ORDER_LINE_ID
and b.campaign_seq=c.campaign_seq
and b.contact_info_seq=d.contact_info_seq
and a.p_sim_seq = e.p_sim_seq
and b.p_number_seq=f.p_number_seq
and a.p_number_import_seq = g.p_number_import_seq
All I want is to have an empty field if the field is empty.
Regards
Lars