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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Join two tables
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Yak Posting Veteran

65 Posts

Posted - 03/28/2013 :  08:08:27  Show Profile  Reply with Quote
Hi I am trying to join two SQl tables to find all customers from the USA

The two tables are Customer and Address are joined by CustomerID

I tried something like this but get errors. Any idea?

Select FirstName,LastName,Email,IsRegistered,OkToEmail FROM Customer
On Customer.CustomerID=Address.CustomerID
WHERE Country='USA'

James K
Flowing Fount of Yak Knowledge

3873 Posts

Posted - 03/28/2013 :  08:23:38  Show Profile  Reply with Quote
What kind of errors did you get? Post the exact text.

Although not related to the error you are getting, if the Country column is in the Address table, you could use INNER JOIN instead of LEFT JOIN. Even if you use left join, it turns out to be an inner join because of the WHERE clause.
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000