I use the following to retrieve a single random record (a "banner" in this 
case). You might be able to modify it for your purpose:

<cfquery name="RandomBanner" datasource="#Banners#" dbtype="#DBTYPE#">
SELECT BannerID
FROM BannerAdverts
WHERE BannerActive = True
</cfquery>

<cfoutput query="RandomBanner">
<cfset SelectBanner = #ListGetAt(BannerID, RandRange(1, ListLen(BannerID))#>
</cfoutput>

<cfquery name="DisplayBanner" datasource="#Banners#" dbtype="#DBTYPE#">
SELECT *
FROM BannerAdverts
WHERE BannerID = #SelectBanner#
</cfquery>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to