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!

Queries is to Access as ____ is to SQL

Status
Not open for further replies.

LadySlinger

IS-IT--Management
Nov 3, 2002
617
US
Hello,

I'm a newbie to SQL 2005. I have had the limited experience that Access brings to the forefront and am now embarking on the SQL Adventure.

Basically I'm looking to find out how to merge information from 2 tables together.

I.e the vendor information is stored on one table and the salesperson info is stored on another. In one form I can see the vendor info with the sales person code. However I want the email address of that sales person with the Vendor information attached.

Thanks!!!
 
You want to use JOINs. You don't give us enough information to help with the code. Table structure (columns) and sample data would help.

However, you can search here and in FORUM183 which is the Microsoft SQL Server PROGRAMMING forum (and where your question really fits). Check out the FAQs in the other forum also.

Basically, a JOIN requires one or more fields to be equal in both tables. That's how you combine them. Let's say salesperson ID is the same in both, you could do...
Code:
SELECT a.col1, b.col2
FROM tablea a
  LEFT JOIN tableb b
    ON a.salespersonID = b.salespersonID
-SQLBill

Posting advice: FAQ481-4875
 
Thanks SQLBill...if I have more issues I'll post in the other forum.

For right now I think I have a hold of it. I Just didn't know where to look. Finally I found the Query Design and have been playing around with that.
 
Another place to look is the BOL (Books OnLine) that comes with SQL Server. Go to Programs>Microsoft SQL Server>Books OnLine. Use the Index tab and enter JOIN.

-SQLBill

Posting advice: FAQ481-4875
 
if your are used to using access a good way to progress into sql server is just create a database with tables in access and make the query as you normally would for access. Use the sql view to look at how it rights the sql code and you can practically copy and past it into server. Use a view to create the query once you are in sql server as it will correct a lot of little mistakes automatically as well as give you the same graphic feel as access.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top