Clif
asked on
Odd Join Behavior
Unfortunately I cannot give you a sample, because a sample works.
Basically I have two tables that each contains several fields. The tables were created by a third party application, and the data in them was inserted by that same app (basically no accidental mistyping of data).
The first table, we'll call Invoice, the second we'll call JobMaster
My query looks like this:
I know a record exists and can see the JobNo values in both tables. I can copy the JobNo value returned from the query and put it in the WHERE clause of a separate query on JobMaster and the record will be returned. I even tried LTRIM(RTRIM()) just in case there were some spurious spaces not apparent but that didn't work either.
Now I'll be the first to admit, I'm not a DBA or even a full fledged DB Developer, but this is a simple query of the type I've done dozens of times in the past.
What's up?
Basically I have two tables that each contains several fields. The tables were created by a third party application, and the data in them was inserted by that same app (basically no accidental mistyping of data).
The first table, we'll call Invoice, the second we'll call JobMaster
My query looks like this:
SELECT
dbo.Invoice.Company,
dbo.Invoice.Vendor,
dbo.Invoice.JobNo,
dbo.JobMaster.JobName
FROM
dbo.Invoice
LEFT OUTER JOIN dbo.JobMaster
ON dbo.JobMaster.Company = dbo.Invoice.Company
AND dbo.JobMaster.JobNo = dbo.Invoice.JobNo
For some reason, nothing from JobMaster is coming through (it's all NULL)I know a record exists and can see the JobNo values in both tables. I can copy the JobNo value returned from the query and put it in the WHERE clause of a separate query on JobMaster and the record will be returned. I even tried LTRIM(RTRIM()) just in case there were some spurious spaces not apparent but that didn't work either.
Now I'll be the first to admit, I'm not a DBA or even a full fledged DB Developer, but this is a simple query of the type I've done dozens of times in the past.
What's up?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I did, but did not try trimming them. Once I did, the query worked.
Thanks for leading me in the right direction.
Thanks for leading me in the right direction.
ASKER