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 |
cecilius
Starting Member
19 Posts |
Posted - 2002-09-15 : 04:10:08
|
Hi, is there an opposite clause to TOP, like LAST for use with select-statements? Or, is there any way to get this:select LAST 10 * FROM (SELECT TOP 50 * from ...Thank you very much and best regardsceci |
|
BigRetina
Posting Yak Master
144 Posts |
|
martybog
Starting Member
1 Post |
Posted - 2004-04-22 : 14:12:49
|
The SELECT statement example will not do what you expect. Here is what it will do (try it in any database):1. Executing within the parens, it will order ALL of table1.Id in descending order and then take the TOP 20 Id values from the descending list.2. It will take the TOP 10 Id values from that resulting list and order them ascending.What you end up with is the 10 records which are 20 records from the "bottom" of the list ordered by Id. |
|
|
Lewie
Starting Member
42 Posts |
Posted - 2004-04-24 : 02:51:07
|
SELECT Top 10 FUTO,*FROM ( Select * from (Select Top 50 <FieldUsedToOrder> as FUTO,* from <Table> order by <FieldUsedToOrder>) a order by FUTO DESC) bORDER BY FUTO |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2004-04-24 : 08:12:47
|
the opposite ofSELECT TOP 10 FROM .... ORDER BY A ASCisSELECT TOP 10 FROM .... ORDER BY A DESC- Jeff |
|
|
|
|
|