Nick,

Are you using SQL Server?  SELECT TOP 1 col FROM tbl ORDER BY NEWID() should
do the trick.

There are other ways for other DBMS...of course :-)

David L. Penton, Microsoft MVP
JCPenney Technical Specialist / Lead
"Mathematics is music for the mind, and Music is Mathematics for the
Soul. - J.S. Bach"
[EMAIL PROTECTED]

Do you have the VBScript Docs or SQL BOL installed?  If not, why not?
VBScript Docs: http://www.davidpenton.com/vbscript
SQL BOL: http://www.davidpenton.com/sqlbol

-----Original Message-----
From: Nick Middleweek [mailto:[EMAIL PROTECTED]]

Hello,

I'd like to SELECT a random record from table.

What's the best way of doing this?

I'm thinking that I need to SELECT all ID's into an array, randomly choose
an element and then do another SELECT ... WHERE ID = chosen_ID


Can I do it in one operation?


Thanks,
Nick


---
You are currently subscribed to activeserverpages as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]

Reply via email to