Mike Kear said: > Ike, your query will still attempt to select records that have been > deleted The original problem was that the keys werent sequential > if some records have been deleted. That's going to happen as ads are > removed. Using the technique I use, it selects a random record > from the records that exist in the table, whether sequential or not.
Umm... nope... non-sequential keys won't be an issue with the solution I posted because I used a randrange against the number of records in the query and then fetched the ID from that record using array-notation, so the ID is guaranteed to be in that query when it performs the 2nd fetch. > Ike, your solution requires two trips to the database, mine requires > one. So . my dad can beat your dad . nyah nyah nyah !! <g> Heh... you need to get your eyes checked. The 2nd query is a query of query. :) The only real issue he might have with it is that he might want to see ads removed immediately when he deletes them in his app and that code won't remove them right away, it'll wait until the following day. And that actually means that my code would be making a LOT fewer trips to the database in total (1 per day instead of 1 per request). ;) But he could of course reduce the cache duration and have the changes show up every hour or so if he didn't want to either throw away all the cache or produce a more complicated solution for invalidating the cache. -- s. isaac dealey ^ new epoch isn't it time for a change? ph: 781.769.0723 http://onTap.riaforge.org/blog ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:316237 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4