How can I get this SQL to work - Access XP

N

Newbie

I have two tables and I want to return all the records from tblCustomers
with information from Customer_Addresses - if there isn't any information in
Customer_Addresses that meets the criteria I just want empty fields

ACCOUNT NO ADDRESS.

Here is the SQL I have but it says it doesn't support the join - AND
Customer_Addresses.[ADDRESS NUMBER] = "11". If I put this in the Where
clause then I don't get all the records from tblCustomer

SELECT tblCustomers.[ACCOUNT NO], Customer_Addresses.[ADDRESS LINE 1],
Customer_Addresses.[ADDRESS LINE 2], Customer_Addresses.[ADDRESS LINE 3],
Customer_Addresses.[ADDRESS LINE 4], Customer_Addresses.[POST CODE]
FROM tblCustomers LEFT JOIN Customer_Addresses ON tblCustomers.[ACCOUNT NO]
= Customer_Addresses.[ACCOUNT NUMBER] AND Customer_Addresses.[ADDRESS
NUMBER] = "11"

Thanks
 
B

Brian

Newbie said:
I have two tables and I want to return all the records from tblCustomers
with information from Customer_Addresses - if there isn't any information in
Customer_Addresses that meets the criteria I just want empty fields

ACCOUNT NO ADDRESS.

Here is the SQL I have but it says it doesn't support the join - AND
Customer_Addresses.[ADDRESS NUMBER] = "11". If I put this in the Where
clause then I don't get all the records from tblCustomer

SELECT tblCustomers.[ACCOUNT NO], Customer_Addresses.[ADDRESS LINE 1],
Customer_Addresses.[ADDRESS LINE 2], Customer_Addresses.[ADDRESS LINE 3],
Customer_Addresses.[ADDRESS LINE 4], Customer_Addresses.[POST CODE]
FROM tblCustomers LEFT JOIN Customer_Addresses ON tblCustomers.[ACCOUNT NO]
= Customer_Addresses.[ACCOUNT NUMBER] AND Customer_Addresses.[ADDRESS
NUMBER] = "11"

Thanks

Parentheses required around join expressions:

SELECT tblCustomers.[ACCOUNT NO], Customer_Addresses.[ADDRESS LINE 1],
Customer_Addresses.[ADDRESS LINE 2], Customer_Addresses.[ADDRESS LINE 3],
Customer_Addresses.[ADDRESS LINE 4], Customer_Addresses.[POST CODE]
FROM tblCustomers LEFT JOIN Customer_Addresses ON (tblCustomers.[ACCOUNT NO]
= Customer_Addresses.[ACCOUNT NUMBER] AND Customer_Addresses.[ADDRESS
NUMBER] = "11")
 
N

Newbie

Thanks works a treat!
Brian said:
Newbie said:
I have two tables and I want to return all the records from tblCustomers
with information from Customer_Addresses - if there isn't any
information
in
Customer_Addresses that meets the criteria I just want empty fields

ACCOUNT NO ADDRESS.

Here is the SQL I have but it says it doesn't support the join - AND
Customer_Addresses.[ADDRESS NUMBER] = "11". If I put this in the Where
clause then I don't get all the records from tblCustomer

SELECT tblCustomers.[ACCOUNT NO], Customer_Addresses.[ADDRESS LINE 1],
Customer_Addresses.[ADDRESS LINE 2], Customer_Addresses.[ADDRESS LINE 3],
Customer_Addresses.[ADDRESS LINE 4], Customer_Addresses.[POST CODE]
FROM tblCustomers LEFT JOIN Customer_Addresses ON tblCustomers.[ACCOUNT NO]
= Customer_Addresses.[ACCOUNT NUMBER] AND Customer_Addresses.[ADDRESS
NUMBER] = "11"

Thanks

Parentheses required around join expressions:

SELECT tblCustomers.[ACCOUNT NO], Customer_Addresses.[ADDRESS LINE 1],
Customer_Addresses.[ADDRESS LINE 2], Customer_Addresses.[ADDRESS LINE 3],
Customer_Addresses.[ADDRESS LINE 4], Customer_Addresses.[POST CODE]
FROM tblCustomers LEFT JOIN Customer_Addresses ON (tblCustomers.[ACCOUNT NO]
= Customer_Addresses.[ACCOUNT NUMBER] AND Customer_Addresses.[ADDRESS
NUMBER] = "11")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top