By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,964 Members | 1,810 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,964 IT Pros & Developers. It's quick & easy.

Correlated Subqueries vs Joins

P: 1
Greetings,
I am a newbie, I have been working to extract data from a basic sales db and trying to decide when I should use joins and when I should use subqueries. Much of what I read online says use subqueries only as a last resort, especially correlated ones as they do a record by record data evaluation and are very resource intensive. Are joins and WHERE and HAVING clauses the preferred method for extracting related data?

But in SQL Server 2005 when I look at execution plan tor a query that uses a subquery and compare it to the execution plan of the join query it seems rather similar..???

Is it older apps that have a harder time doing the subqueries? Is is just inelegant?

I appreciate any input folks have on this issue.

Thanks much,
Lizandra
Jan 23 '08 #1
Share this Question
Share on Google+
1 Reply


ck9663
Expert 2.5K+
P: 2,878
Greetings,
I am a newbie, I have been working to extract data from a basic sales db and trying to decide when I should use joins and when I should use subqueries. Much of what I read online says use subqueries only as a last resort, especially correlated ones as they do a record by record data evaluation and are very resource intensive. Are joins and WHERE and HAVING clauses the preferred method for extracting related data?

But in SQL Server 2005 when I look at execution plan tor a query that uses a subquery and compare it to the execution plan of the join query it seems rather similar..???

Is it older apps that have a harder time doing the subqueries? Is is just inelegant?

I appreciate any input folks have on this issue.

Thanks much,
Lizandra
although the WHERE style of joining tables will work on inner join, am not sure if it can still support the *= for left join and =* for right join. i don't think so. in addition, it will be confusing which part of the where is filter and which part is the join...so it's still preferred to use the JOIN technique of accessing related tables.


-- ck
Jan 24 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.