[thelist] A Little Query Question

Peter Brunone (EasyListBox.com) peter at easylistbox.com
Sat Dec 3 00:12:20 CST 2005


	Well, the flip side of that performance coin is that once you
load the DataTable, you can cache it in memory and use it as many times
as you like without hitting the database again at all!

-----Original Message-----
From: thelist-bounces at lists.evolt.org On Behalf Of Casey Crookston

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