Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 joins

Author  Topic 

basicconfiguration
Constraint Violating Yak Guru

358 Posts

Posted - 2010-08-07 : 18:15:51
how many joins can we have in a query ?
how many joins is too many joins?

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-08-07 : 18:21:43
What a question!
Try it out.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

basicconfiguration
Constraint Violating Yak Guru

358 Posts

Posted - 2010-08-07 : 18:22:49
Just say you don't know.
Go to Top of Page

kashyap_sql
Posting Yak Master

174 Posts

Posted - 2010-08-09 : 01:55:24
1.Inner Join
2. Outer Join
i.Left Outer Join
ii.Right Outer Join
iii.Full Outer Join
3.Cross Join
don't criticize the people


With Regards
Kashyap M
Go to Top of Page

ewomack
Starting Member

33 Posts

Posted - 2010-08-09 : 09:00:31
I'm not aware of any hard fast limits. Like a lot of things, this will depend... hopefully database design would take care of any need to do 30 - 40 joins in a single query. If you find yourself doing that many, it may be time to redesign the data schema. Though there's not really a definite answer for this, you would not want to include more joins than adversely affects query performance. This will of course depend on the amount of data in the joined tables and other environmental factors. So the answer to your question is pretty situational. As far as I know there is no single answer like "20." But best practice should limit join use down to what you need. You don't want to include more joins than a query calls for. There's no single answer to your question.

Ed Womack
www.getmilked.com
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-08-09 : 09:18:14
quote:
Originally posted by basicconfiguration

Just say you don't know.


OK
I don't (need to) know.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -