Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 error multi-part identifier could not be bound

Author  Topic 

cwheless
Starting Member

2 Posts

Posted - 2009-04-24 : 18:20:58
How would I rewrite this query using outer joins (so that null values can be included in the result set)?

select w.proposal, w.description, f.tranx_date, pmc.pm_measure, wn.notes
from ae_p_pro_e as w, ae_s_fnd_a as f, ae_p_pms_measure as pmc, ae_p_pro_e_notes as wn, ae_p_phs_e
where w.proposal=f.proposal
and w.proposal=pmc.proposal
and w.proposal=wn.proposal
and w.proposal=ae_p_phs_e.proposal
and w.order_type = 'PM'
and w.category= 'GENERATORS'
and ae_p_phs_e.status_code in ('COMPLETE', 'CLOSED')

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2009-04-24 : 19:24:01
I'm not sure how you wanted to apply your restrictions.. like this:
select 
w.proposal,
w.description,
f.tranx_date,
pmc.pm_measure,
wn.notes
from
ae_p_pro_e as w
left outer join
ae_s_fnd_a as f
on w.proposal=f.proposal
left outer join
ae_p_pms_measure as pmc
on w.proposal=pmc.proposal
left outer join
ae_p_pro_e_notes as wn
on w.proposal=wn.proposal
left outer join
ae_p_phs_e
on w.proposal=ae_p_phs_e.proposal
where
w.order_type = 'PM'
and w.category= 'GENERATORS'
and ae_p_phs_e.status_code in ('COMPLETE', 'CLOSED')
Or this:
select 
w.proposal,
w.description,
f.tranx_date,
pmc.pm_measure,
wn.notes
from
ae_p_pro_e as w
left outer join
ae_s_fnd_a as f
on w.proposal=f.proposal
left outer join
ae_p_pms_measure as pmc
on w.proposal=pmc.proposal
and w.order_type = 'PM'
and w.category= 'GENERATORS'
left outer join
ae_p_pro_e_notes as wn
on w.proposal=wn.proposal
left outer join
ae_p_phs_e
on w.proposal=ae_p_phs_e.proposal
and ae_p_phs_e.status_code in ('COMPLETE', 'CLOSED')
Go to Top of Page

cwheless
Starting Member

2 Posts

Posted - 2009-04-26 : 19:03:44
It was the first one, many thanks!

quote:
Originally posted by Lamprey

I'm not sure how you wanted to apply your restrictions.. like this:
select 
w.proposal,
w.description,
f.tranx_date,
pmc.pm_measure,
wn.notes
from
ae_p_pro_e as w
left outer join
ae_s_fnd_a as f
on w.proposal=f.proposal
left outer join
ae_p_pms_measure as pmc
on w.proposal=pmc.proposal
left outer join
ae_p_pro_e_notes as wn
on w.proposal=wn.proposal
left outer join
ae_p_phs_e
on w.proposal=ae_p_phs_e.proposal
where
w.order_type = 'PM'
and w.category= 'GENERATORS'
and ae_p_phs_e.status_code in ('COMPLETE', 'CLOSED')
Or this:
select 
w.proposal,
w.description,
f.tranx_date,
pmc.pm_measure,
wn.notes
from
ae_p_pro_e as w
left outer join
ae_s_fnd_a as f
on w.proposal=f.proposal
left outer join
ae_p_pms_measure as pmc
on w.proposal=pmc.proposal
and w.order_type = 'PM'
and w.category= 'GENERATORS'
left outer join
ae_p_pro_e_notes as wn
on w.proposal=wn.proposal
left outer join
ae_p_phs_e
on w.proposal=ae_p_phs_e.proposal
and ae_p_phs_e.status_code in ('COMPLETE', 'CLOSED')


Go to Top of Page
   

- Advertisement -