SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Joins?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Tototo1
Starting Member

22 Posts

Posted - 02/24/2012 :  16:13:35  Show Profile  Reply with Quote
Hello,

I am trying to understand what exactly a JOIN does. I get that this will put to tables together, but is there anyway of actually 'seeing' the join and what it is doing. When I try to use these and pull data, my idea of what is happening versus what is actually happening has to be different. Let's say I have a table

X
Customer CustomerID Payment
Bill 2222 $400
Dave 3333 $500

and table

Y
CustomerTag PurchaseItem
2222 Doll
2211 Truck
3333 Car


If I do a join on these tables with x.customerid = y.customertag what does this actually 'do'?

sunitabeck
Flowing Fount of Yak Knowledge

5152 Posts

Posted - 02/24/2012 :  16:18:12  Show Profile  Reply with Quote
Take a look at this page (and the pages following that which explain different types of joins). It does a very good job of explaining, using an example almost similar to yours:http://www.w3schools.com/sql/sql_join.asp
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
47099 Posts

Posted - 02/25/2012 :  11:33:04  Show Profile  Reply with Quote
quote:
Originally posted by Tototo1

Hello,

I am trying to understand what exactly a JOIN does. I get that this will put to tables together, but is there anyway of actually 'seeing' the join and what it is doing. When I try to use these and pull data, my idea of what is happening versus what is actually happening has to be different. Let's say I have a table

X
Customer CustomerID Payment
Bill 2222 $400
Dave 3333 $500

and table

Y
CustomerTag PurchaseItem
2222 Doll
2211 Truck
3333 Car


If I do a join on these tables with x.customerid = y.customertag what does this actually 'do'?


it will link the two tables based on the condition and then return the data which have exact matches
ie



Customer      CustomerID       Payment     PurchaseItem 
Bill          2222             $400        Doll
Dave          3333             $500        Car


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
  Previous Topic Topic Next Topic  
 New 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.09 seconds. Powered By: Snitz Forums 2000