select distinct
page0.MatterType,
page0.Name,
page0.MatterNo,
page0.security,
page0.serial,
page6.TribCaseNo,
contact0.Name as Cname
from
page0, page6, page14
left join
contact0 on page0.PrimaryContact = contact0.linkserial
where
page0.serial = page6.CaseSerial
AND page0.serial = page14.CaseSerial
AND (page14.staffmember = '100001^24' and page14.status != 'Inactive')
AND page0.status != 'Closed'
I keep getting an error that
the multi-part identifier page0.PrimaryContact could not be bound.
I've checked the syntax and the spelling and both seem to be correct.
Thanks!
You can make your query work by changing the order of tables in FROM
:
select distinct
page0.MatterType,
page0.Name,
page0.MatterNo,
page0.security,
page0.serial,
page6.TribCaseNo,
contact0.Name as Cname
from
page6, page14, page0 --NOTE: page0 is now closest to join!!!
left join
contact0 on page0.PrimaryContact = contact0.linkserial
where
page0.serial = page6.CaseSerial
AND page0.serial = page14.CaseSerial
AND (page14.staffmember = '100001^24' and page14.status != 'Inactive')
AND page0.status != 'Closed'
Update.
In general, I strongly encourage you not to mix old and new syntax (as it's done here),p.campbell's solution is the right way to write queries.