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
 SubQuery

Author  Topic 

ameya_amu
Starting Member

25 Posts

Posted - 2006-03-09 : 00:09:25
I am cofuse with subquery.HOW does subquery work. the inner or outer query exicute first. what are different type of sub query. plz give example. i am more confuse with exits subquery

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-03-09 : 00:58:56
Read about subqueries in SQL Server's help file

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

a_r_satish
Yak Posting Veteran

84 Posts

Posted - 2006-03-13 : 06:32:01
Please be precise with your queries. The details about subqueries can be studied from BOL on Help.
Be specific in asking the doubts,so that it is easy to answer. Please take this as advice and not as harsh statement

Regards,
satish.r
"Known is a drop, Unknown is an Ocean"
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2006-03-13 : 06:58:08
the main differences are between corrlated and non-corelated subqueries.
A non-correlated subquery can be executed independantly and the result set used in the main query.
A correlated subquery has to be executed for each row in the main query (i.e. it references a data item from the main query).

What is executed first is at the mercy of the optimiser - it might help you to visualise what is happening but that doesn't mean it will be actually executed in that order.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -