Any time you want to first sort a dataset and then limit the number of rows
returned, you MUST use a view to select and sort the dataset.  Then select
from the view and limit the number of rows returned.  You will get the
correct result.


The reason you have to do it this way is that a WHERE clause limits the rows
returned BEFORE the sorting.  Otherwise performance could go out the window.


-- Dennis McGrath
mailto:[EMAIL PROTECTED]

-- Tools for R:BASE programmers
http://www.enteract.com/~mcgrath/dennis

-- Full time consultant with SQL Resources
mailto:[EMAIL PROTECTED]

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
Behalf Of Ron Rose
Sent: Wednesday, November 14, 2001 4:32 PM
To: [EMAIL PROTECTED]
Subject: Re: Limit = with Order by Desc


Investigate CREATE INDEX Note: (colname DESC)
Colname is now always descending, no order by needed.
RRR

MikeB wrote:
>
> RB 65 Win/Dos.  If I want to do a select or chose on a dataset say based
on
> an Int or Date col in descending order Then limit the number of selections
> with Limit = , the expected result would be the highest value Int or Date,
> but this is not the result.  The workaround is a Temp View, etc.



Reply via email to