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

Constraint Violating Yak Guru

358 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,
@computer c
@user u on u.computerid = c.computerid

select c.computerid,
@computer c
@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?

Almighty SQL Goddess

38200 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

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