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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 SubQuery

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-05-11 : 08:18:25
ASHOK writes "How can I write a Query which returns multiple rows in its inner query.The outer Query will fetch the record based on the criteria returned by inner query. Please send me an Example
"

nr
SQLTeam MVY

12543 Posts

Posted - 2006-05-11 : 08:37:31
maybe

select
from tbl
where id in (select id from ......)


==========================================
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

Srinika
Master Smack Fu Yak Hacker

1378 Posts

Posted - 2006-05-11 : 08:56:59
But, since the use of "sub query" is inefficient,
u may use a "Join" instead!!

Select t1.F1, t1.F2 ...
from t1
inner join t2 on t1.id = t2.id

Srinika
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-05-11 : 09:11:04
Also look for subqueries in sql server help file

Madhivanan

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

- Advertisement -