You would need to take the column used for your ORDER BY clause to build a WHERE predicate.
For instance, if you first query does this: SELECT * FROM DataTable WHERE ... ORDER BY entryID Then your subsequent queries could do: SELECT TOP 5 * FROM DataTable WHERE ... AND entryID > LastRow ORDER BY entryID If you database doesn't support TOP use the maxrows attribute of the cfquery tag instead. - Daniel Elmore -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jake McKee Sent: Sunday, March 06, 2005 2:18 AM To: [email protected] Subject: Re: Query question Sorry, not quite what I meant (it's late, I'm not communicating well). The two queries are not nested. So query 1 runs like this: 1 2 3 4 5 Then, based on the entryID for the last row (5 in this case), the second query picks up where that left off 6 7 8 9 10 Basically, I'm trying to achieve something like - Entry 1 -- some in depth details - Entry 2 -- some in depth details ... - Entry 5 -- some in depth details ---------------------- Other entries: -- entry 6 - no details, other meta data -- ... -- entry 10 Make sense? Daniel Elmore wrote: >I didn't completely understand your question, but perhaps this will help. > >Coldfusion keeps track of current row ID for you. Just use >query_name_here.CurrentRow > >If you want to perform another query every 5 rows just use: ><cfif query_name_here.CurrentRow MOD 5 EQ 0> > Run some query ></cfif> > > >- Daniel Elmore > > >-----Original Message----- >From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf >Of Jake McKee >Sent: Sunday, March 06, 2005 1:34 AM >To: [email protected] >Subject: Query question > >OK, I'm trying to do something funky and can't quite seem to make it click. > >I run a big ass query, get some results, use CFOUTPUT to output those >results. I use a variable that I reset with each new DB row output in >order to find the last row ID of the query results. > >Now, what I'd like to do find the next 5 most recent entries in the DB, >starting from that last row ID. > >So database has rows 1-20. My first query looks like: > >1 >2 >3 >4 > >I want the results of my second query to be: > >5 >6 >7 >8 >9 >10 > >Makes sense? How would I do such a thing? > >Thanks! >Jake > > >---------------------------------------------------------- >To post, send email to [email protected] >To unsubscribe: > http://www.dfwcfug.org/form_MemberUnsubscribe.cfm >To subscribe: > http://www.dfwcfug.org/form_MemberRegistration.cfm > > > >---------------------------------------------------------- >To post, send email to [email protected] >To unsubscribe: > http://www.dfwcfug.org/form_MemberUnsubscribe.cfm >To subscribe: > http://www.dfwcfug.org/form_MemberRegistration.cfm > > > > > > > > ---------------------------------------------------------- To post, send email to [email protected] To unsubscribe: http://www.dfwcfug.org/form_MemberUnsubscribe.cfm To subscribe: http://www.dfwcfug.org/form_MemberRegistration.cfm ---------------------------------------------------------- To post, send email to [email protected] To unsubscribe: http://www.dfwcfug.org/form_MemberUnsubscribe.cfm To subscribe: http://www.dfwcfug.org/form_MemberRegistration.cfm
