Is there a way to perform a random fetch using a cursor?

Todd Ashworth

----- Original Message -----
From: "Bert Dawson" <[EMAIL PROTECTED]>
To: "Fusebox" <[EMAIL PROTECTED]>
Sent: Tuesday, December 12, 2000 2:56 PM
Subject: RE: Random record?


| definately more elegant and efficient than mine, and more 'random' (and
| elegant) than Nat's suggestion
| ;)
| However....what about when a row has been deleted, ie there is now id
which
| matches the condition?
| I suppose then it gets a bit tricky with a stored procedure loop thing....
|
| Bert
|
| > -----Original Message-----
| > From: McCollough, Alan [mailto:[EMAIL PROTECTED]]
| > Sent: 12 December 2000 19:28
| > To: Fusebox
| > Subject: RE: Random record?
| >
| >
| > Okay, here is pure SQL solution stolen right from www.swynk.com:
| >
| > select *
| > from foo
| > where id = rand() * (select max(id) from foo) + 1
| >
| > Alan McCollough
| > Web Programmer
| > Allaire Certified ColdFusion Developer
| > Alaska Native Medical Center



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to