Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Returns wrong results

Status
Not open for further replies.

Cpreston

MIS
Mar 4, 2015
972
GB
Hi

I am having issue getting a result from a couple of tables

The customer ContactAddress as 3 results when I run Select * from CustomerAddress where CustomerID = 2473
The Customer Contact Table as 7 results when I run Select * from CustomerContact where CustomerID = 2473

However when I join them together using the following,I am getting null in the field dbo.CustomerAddress.udfTrexAccountManager. When I run Select * from CustomerAddress where CustomerID = 2473 it shows the right information in the udfTrexAccountManager field. The query below returns 7 names but null for the udfTrexAccountManager field. I have ried all joins but cannot get it working, any ideas please. Thanks

SQL:
SELECT        dbo.CustomerContact.CustomerID, dbo.CustomerContact.Name, dbo.CustomerAddress.udfTrexAccountManager
FROM            dbo.CustomerAddress FULL OUTER JOIN
                         dbo.CustomerContact ON dbo.CustomerAddress.CustomerAddressID = dbo.CustomerContact.AddressID
WHERE        (dbo.CustomerContact.CustomerID = 2473)
 
It is ok thanks, I found the issue, it had more that one key I could link in.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top