You could also add a RowNumber column to your query:
<cfset QueryAddColumn(qSomeQuery, "RowNumber") >
<cfloop from="1" to="qSomeQuery.RecordCount" index="RowNumber" >
<cfset QuerySetCell(qSomeQuery, "RowNumber", RowNumber, RowNumber) >
</cfloop>
Then, do:
<cfquery name="qMyQuery" dbtype="query">
SELECT *
FROM qSomeQuery
WHERE RowNumber >= 21 AND RowNumber < 41
ORDERY BY LastName
</cfquery>
Not sure what the performance hit on doing this would be.
Jon
On 1/5/07, Dave Phillips <[EMAIL PROTECTED]> wrote:
> Does anyone know if it's possible to extract a 'subset' of records in a query
> utilizing Query of Queries? Basically I want to do something like this:
>
> <cfquery name="qMyQuery" dbtype="query">
> SELECT *
> FROM qSomeQuery
> WHERE currentRow >= 21 AND currentRow < 41
> ORDERY BY LastName
> </cfquery>
>
> Of course, this doesn't work because currentrow does not specify the row
> number inside of a Query, only when you are working with the query results
> directly (like qSomeQuery.currentRow).
>
> Anyone know how this is possible? The only thing I can think of doing is
> something like this:
>
> <cfoutput name="qSomeQuery" startRow="21" maxrows="40">
> *** In here I would build a new query with only the rows available as I
> loop through with functions like queryAddRow() and querySetCell().
> </cfoutput>
>
> This idea would not be very efficient, so I'm looking for an alternative
> method.
>
> Thanks for your help in advance!
>
> Dave
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:265888
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4