Heh .. this reminds me of the classic example of how to generate a random
number from the good Ol' days of coding in BASIC ... in fact it's, more or
less, the same syntax. Leave it to MS to, um .. 'innovate' hehe
Todd Ashworth
----- Original Message -----
From: "Michael 'Maxx' Porter" <[EMAIL PROTECTED]>
To: "Fusebox" <[EMAIL PROTECTED]>
Sent: Tuesday, December 12, 2000 7:57 PM
Subject: RE: Random record?
> That is a beautiful piece of code. I have to do this for a site next
> week..saved my weekend thanks.
>
>
> At 11:08 AM 12/12/00 -0900, you wrote:
> >declare @rand_id int
> >while @rand_id is null
> >BEGIN
> >set @rand_id = (select id
> >from table
> >where id = rand() * (select max(id) from table) + 1)
> >END
> >select * from table where id = @rand_id
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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