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:39:51
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

robvolk
Most Valuable Yak

15732 Posts

Posted - 2005-11-17 : 21:19:08
Dupe:

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=57894
Go to Top of Page
   

- Advertisement -