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'?
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
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/