Allow me to modify my previous post then...

  <CFPARAM lownum = 0>
<CFQUERY>
  select top 20 * from mytable
  where mytableID > #lownum#
</CFQUERY>
<CFSET highID = lownum>
<CFOUTPUT query=myquery>
   <CFSET highID = myquery.mytableID>
</CFOUTPUT>

<FORM blahblahblah>
  <INPUT type="hidden" name="lownum" value=#highID#>
</FORM>


  All the queries will return only 20.  And you're keeping track of the 
highest ID that was returned, and using that as the lowestID.  The next 
query (when hitting the next button) will return the first 20 rows greater 
than your previous...


At 09:39 AM 03/10/2001 -0800, you wrote:
>Al,
>
>Thanks for the quick response, but I can't count on the identity column
>being contiguous because entries have been deleted.
>
>-- Brett
>
>A 12:33 PM 3/10/2001 -0500, you wrote:
>
> >Have an autoincrement field in the database.
> >   use it as the key to get each group. For example, on the first round, you
> >would do:
> >
> >select whatever from whatever, where
> >ID > N1  and ID < N2
> >
> >Pass N1 and N2 back and forth between templates, and have a next group,
> >previous group manipulate N1 and N2 so it picks up the right records.
> >
> >
> >
> >Al
> >A1webs.com
> >
> > > > I've got a simple guestbook application that holds 250 guestbooks 
> so far.
> > > > Some of the guestbooks are have up to 13000 records.
> > > >
> > > > I am returning the entire recordset and looping through it 20
> > > > records at a
> > > > time (I didn't think that it would get to be so big), but the query 
> times
> > > > out on 13000 records. The database (Sybase)  is optimized like
> > > > butter and I
> > > > can hit it from 20 clients at the same time with no response 
> problems. I
> > > > would like to stay away from cursors, because the can get messy.
> > > >
> > > > I have already tried caching the query (which doesn't really help 
> because
> > > > there are always new records begin added) and converting it to a 
> session
> > > > variable (which doesn't help because it just eats the ram on the
> > > > boxes), so I need to rewrite.
> > > >
> > > > Does any one have any suggestions or know if there is a custom tag out
> > > > there that increments the number of records returned as you step 
> through
> > > > the result set? I have checked Allaires repository, but no luck :)
> > > >
> > > > If not, I will write one and share it with the group if anyone is
> > > > interested.
> > >
> > >Write the template intelligently so it's not bringing back 13,000 records
> > >when you only need 20 - that's just insane!
> > >
> > >The fastest way I can think of to do this is to find the last entry date,
> > >bring back 25 just in case there are several at exactly the same time, and
> > >pass through in the "next 20" button the date of the last entry and 
> the IDs
> > >of the entries shown on the previous page
> > >
> > >That way your db access is kept to a minimum, and speed will shoot through
> > >the roof
> > >
> > >Philip Arnold
> > >Director
> > >Certified ColdFusion Developer
> > >ASP Multimedia Limited
> > >T: +44 (0)20 8680 1133
> > >
> > >"Websites for the real world"
> > >
> > >**********************************************************************
> > >This email and any files transmitted with it are confidential and
> > >intended solely for the use of the individual or entity to whom they
> > >are addressed. If you have received this email in error please notify
> > >the system manager.
> > >**********************************************************************
> > >
> > >
> > >
> > >
> >
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to