What DB?  With SQL Server 2K, I think the following will work
(untested - going straight from distant memory):

SELECT TOP 1 myfield
FROM mytable
ORDER BY NEWID()

On 3/29/06, Will Tomlinson <[EMAIL PROTECTED]> wrote:
> I need to pull a random record from an autonumber field. It's for a prize for 
> the lucky winner. :)
>
> I'd thought about creating a ValueList() from the ID field, but then got 
> stuck in my thinking. What's the best way to accomplish this?
>
> Thanks,
> Will
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:236458
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to