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.
Author |
Topic |
flamz
Starting Member
21 Posts |
Posted - 2008-02-27 : 16:43:44
|
Hi, I'd like to get the minimum date from a SELECT query that uses TOP but I can't get it to compile:SELECT MIN(DATE) FROM (SELECT TOP 3 * FROM MyTable WHERE recId=1) |
|
flamz
Starting Member
21 Posts |
Posted - 2008-02-27 : 16:49:10
|
never mind, got it:SELECT MIN(DATE)FROM MyTableWHERE DATE IN(SELECT TOP 10 DATEFROM MyTable WHERE recID =10) AND recID =10 |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-02-28 : 00:54:31
|
quote: Originally posted by flamz Hi, I'd like to get the minimum date from a SELECT query that uses TOP but I can't get it to compile:SELECT MIN(t.DATE) FROM (SELECT TOP 3 * FROM MyTable WHERE recId=1)t
|
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-02-28 : 00:57:16
|
And don't forget the ORDER BY to get consistent result with TOP. E 12°55'05.25"N 56°04'39.16" |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|