[thelist] A Little Query Question

Casey aspnet at thecrookstons.com
Fri Dec 2 18:39:54 CST 2005


I think the solution here is to load all of the rows into a DataSet instead 
 of trying to load 15 rows at a time into a DataReader.  I was hoping to 
 avoid that with a slick query, but I'm not making it work, so....
 
 ----- Original Message ----- 
 From: "Casey"
 
> How about this:
>
> SELECT TOP 10 FROM (SELECT TOP 20 field1, field2 FROM table1) ORDER BY
> keyID
> DESC
>
> The sub query selects the top 20.  Then the top query selects the top 10
> from the sub set, but orders it backwards by the keyID.  The keyID by
> defenition always gets bigger by each row, so you are bound to get the 
> last
> 10 of the top 20.  Right?
>
> But, as always I would be open to better ideas.
>
> Thanks!
>
> Casey 
>



More information about the thelist mailing list