SELECT TOP And ColdFusion Query Of Queries

<cffunction
	name="QueryTrim"
	access="public"
	returntype="query"
	output="false"
	hint="Trims a query to the number of rows requested.">
 
	<!--- Define arguments. --->
	<cfargument name="Query" type="query" required="true" />
	<cfargument name="RecordCount" type="numeric" required="true" />
 
	<!--- Check to see if we have rows to remove. --->
	<cfif (ARGUMENTS.Query.RecordCount GT ARGUMENTS.RecordCount)>
 
		<!--- Trim the recordset. --->
		<cfset ARGUMENTS.Query.RemoveRows(
			JavaCast( "int", ARGUMENTS.RecordCount ),
			JavaCast( "int", (ARGUMENTS.Query.RecordCount - ARGUMENTS.RecordCount) )
			) />
 
	</cfif>
 
	<!---
		Return the updated query. This is NOT required as
		the query object is passed by reference, not by value.
		However, this would be useful to do as it allows for
		method chaining.
	--->
	<cfreturn ARGUMENTS.Query />
</cffunction>

For Cut-and-Paste