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
 SQL Server Development (2000)
 subquery or not ?

Author  Topic 

iamsmahd
Yak Posting Veteran

55 Posts

Posted - 2005-11-17 : 08:38:31
hi all...

why some times we need to write a subquery in order to get the max, min or avg and some times we don't need ?

for example I do not know that should I use a subquery to get the max of StartDate of a contract or not ?

Select t1.f1
from t1 inner join t2 on t1.f1 = t2.f2
where
(t1.StartDate > max (t2.f3)) OR
(t1.StartDate > (select max t2.f3 from t2 inner join t1 on ......)

sonia

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-11-17 : 09:01:54
It depends on your requirement
Post your exact requirement

Madhivanan

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

- Advertisement -