At 04:51 PM 7/16/2002 -0400, you wrote:
>I'm trying to create a dynamic browse; i.e. the user drops into a record
>located by PK and then I need to find out how many records AFTER and BEFORE
>that record exist. Any ideas?


You using CF5? Sounds like a job for Query of Queries. Don't know if there 
are any efficiency problems with this, but at least it only hits the 
database once.

<code>
<!--- You should probably cache this query if you can --->
<cfquery name="qryAllRecords" datasource="foo" dbtype="odbc">
         SELECT * FROM tblMyTable
</cfquery>

<cfquery name="qryThisRecord" dbtype="query">
         SELECT * FROM qryAllRecords WHERE npkRecordID = #SOMEVALUE#
</cfquery>

<cfquery name="qryCountBefore" dbtype="query">
         SELECT count(*) AS BeforeCount FROM qryAllRecords WHERE 
npkRecordID < #SOMEVALUE#
</cfquery>

<cfquery name="qryCountAfter" dbtype="query">
         SELECT count(*) AS AfterCount FROM qryAllRecords WHERE 
npkRecordID > #SOMEVALUE#
</cfquery>

</code>

-B




_____
Brian Panulla                           [EMAIL PROTECTED]
Chief Information Officer               814.238.6680
Elmwood Media Group                     www.elmwoodmedia.com

______________________________________________________________________
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-linux%40houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_linux or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to