The problem with the "where id > #lastid#" method is when you're trying to
go forward farther than one at a time, or backward. If you're on page 1 of
10, and you want to jump to page 5, how do you know what "lastid" to pass it
at that point? :)

> -----Original Message-----
> From: Aaron Johnson [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, August 02, 2000 12:24 AM
> To: [EMAIL PROTECTED]
> Subject: RE: Paging query results
> 
> 
> Peter,
> 
> one of the ways we came up with was to select "top" amount of 
> rows that you
> want from the db, let's say ten... where the id is greater 
> than so and so...
> 
> query would look like this:
> 
> <cfquery name="getsomething" datasource...>
> 
> SELECT top 10 id
> FROM sometable
> WHERE id > #lastid#
> 
> </cfquery>
> 
> Only works in SQL 7.  check the oreilly Transact SQL book or 
> get some SQL
> documentation for more information.
> 
> Aaorn
> 
> -----Original Message-----
> From: Scott Weikert [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, August 01, 2000 3:02 PM
> To: '[EMAIL PROTECTED]'
> Subject: RE: Paging query results
> 
> 
> Have your query grab the entire range of rows you're looking 
> to show from
> the get-go - no MAXROWS - but cache it. Perhaps use a 
> dynamically-generated
> query name so that two people hitting the page at the same time won't
> overwrite each other's query results.
> 
> Then, instead of doing a straight out <CFOUTPUT 
> QUERY="queryname">, do a
> loop for however many items you want to show - and refer to 
> your query rows
> like you would an array - "queryname.firstname[1]". Use your 
> loop variable
> in the brackets. Since you know how many items you're showing 
> on each page,
> you can pass a page number of some sort back and forth, and 
> calculate the
> start/end values.
> 
> Say you've got 95 items in a query, and you want to show 20 
> at a time... so
> you'd have "1 2 3 4 5" as your links. "1" would pass an start 
> variable of 1,
> "2" would pass 21, "3" 41, etc. and you'd use those variables 
> as the "FROM"
> values in your loops, and "TO" would be that plus 19.
> 
> > -----Original Message-----
> > From: Peter Theobald [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, August 01, 2000 9:46 PM
> > To: [EMAIL PROTECTED]
> > Subject: Paging query results
> >
> >
> > --=====================_18393762==_.ALT
> > Content-Type: text/plain; charset="us-ascii"
> >
> > What is the accepted "best" method of paging query results?
> >
> > I am using STARTROW and MAXROWS to display one page at a
> > time, and calling the same page with different arguments to
> > change the page I am displaying... BUT this reexecutes the
> > query each time. This query searches through a large database
> > and takes a little time. This is a pretty inefficient way to
> > do it (I think).
> >
> > This must be a VERY common thing to do, so what is the
> > recommended way of doing it?
> > I don't want to pass hundreds or thousands of rows of data in
> > a variable...
> >
> > At 10:40 AM 8/1/00 -0700, Ray, James A wrote:
> > >Is there a way in a <FORM> to force Upper Case while using a <INPUT
> > >type="text">?
> > >
> > >Thank you.
> > >
> > >Jim Ray
> > >
> > >
> > >
> > >
> > >
> > >-------------------------------------------------------------
> > -----------------
> > >Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
> > >To Unsubscribe visit
> > http://www.houseoffusion.com/index.cfm?sidebar=lists&body=list
> > s/cf_talk or send a message to
> > [EMAIL PROTECTED] with 'unsubscribe' in the body.
> >
> >
> > --------------------------------------------------------------
> > -------------
> > Peter Theobald, Chief Technology Officer
> > LiquidStreaming http://www.liquidstreaming.com
> > [EMAIL PROTECTED]
> > Phone 1.212.545.1232 Fax 1.212.679.8032
> >
> > --=====================_18393762==_.ALT
> > Content-Type: text/html; charset="us-ascii"
> >
> > <html>
> > <font size=3>What is the accepted &quot;best&quot; method of
> > paging query
> > results?<br>
> > <br>
> > I am using STARTROW and MAXROWS to display one page at a time, and
> > calling the same page with different arguments to change 
> the page I am
> > displaying... BUT this reexecutes the query each time. This query
> > searches through a large database and takes a little time. This is a
> > pretty inefficient way to do it (I think).<br>
> > <br>
> > This must be a VERY common thing to do, so what is the
> > recommended way of
> > doing it?<br>
> > I don't want to pass hundreds or thousands of rows of data in a
> > variable...<br>
> > <br>
> > At 10:40 AM 8/1/00 -0700, Ray, James A wrote:<br>
> > <blockquote type=cite cite>Is there a way in a &lt;FORM&gt; to force
> > Upper Case while using a &lt;INPUT<br>
> > type=&quot;text&quot;&gt;?<br>
> > <br>
> > Thank you.<br>
> > <br>
> > Jim Ray<br>
> > <br>
> > <br>
> > <br>
> > <br>
> > <br>
> > --------------------------------------------------------------
> > ----------------<br>
> > Archives:
> > <a
> > href="http://www.mail-archive.com/cf-talk@houseoffusion.com/"
> > eudora="autourl">http://www.mail-archive.com/cf-talk@houseoffu
> > sion.com/</a><br>
> > To Unsubscribe visit
> > <a
> > href="http://www.houseoffusion.com/index.cfm?sidebar=lists&amp
> > ;body=lists/cf_talk"
> > eudora="autourl">http://www.houseoffusion.com/index.cfm?sideba
> > r=lists&amp;body=lists/cf_talk</a>
> > or send a message to [EMAIL PROTECTED] with
> > 'unsubscribe' in the body. </font></blockquote><br>
> >
> > <font size=2><b><br>
> > --------------------------------------------------------------
> > -------------<br>
> > Peter Theobald, </b>Chief Technology Officer<br>
> > </font><font size=3 color="#0000FF"><b>LiquidStreaming
> > </b></font><a href="http://www.liquidstreaming.com/"
> > eudora="autourl"><font size=2
> > color="#0000FF"><u>http://www.liquidstreaming.com</a><br>
> > </u></font><font size=2>[EMAIL PROTECTED]<br>
> > <b>Phone</b> 1.212.545.1232 <b>Fax</b> 1.212.679.8032<br>
> > </font></html>
> >
> > --=====================_18393762==_.ALT--
> >
> > --------------------------------------------------------------
> > ----------------
> > Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
> > To Unsubscribe visit
> http://www.houseoffusion.com/index.cfm?sidebar=lists&body=list
s/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
----------------------------------------------------------------------------
--
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.



----------------------------------------------------------------------------
--
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to