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 question
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

basicconfiguration
Constraint Violating Yak Guru

357 Posts

Posted - 09/28/2012 :  13:45:54  Show Profile  Reply with Quote
declare @computer table (computerid int, computermodel varchar(20))


declare @user table (userid int, computerid int)

insert @computer
select 1, 'xx' union all
select 1, 'yy' union all
select 1, 'zz'


insert @user
select 1, 1 union all
select 2, 2


select c.computerid,
c.computermodel,
u.userid
from
@computer c
join
@user u on u.computerid = c.computerid


select c.computerid,
c.computermodel,
u.userid
from
@computer c
join
@user u on c.computerid = u.computerid



getting a little bit curious about how to use the columns when using a join. I dont know which columns to use first to gain the best performance when doing a join.
I checked the execution plan and both gives me the same execution plan. therefore, I think it doesn't matter the order of the columns in the join. Am i right?

tkizer
Almighty SQL Goddess

USA
37287 Posts

Posted - 09/28/2012 :  13:50:50  Show Profile  Visit tkizer's Homepage  Reply with Quote
Ordering doesn't matter.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
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.05 seconds. Powered By: Snitz Forums 2000