Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Radom ID select from db

Status
Not open for further replies.

snowboardr

Programmer
Feb 22, 2002
1,401
PH
What would be the most efficient way to randomly select a ID number out of a table? Ie for a banner exchange app. www.vzio.com
star.gif
/ [wink]
 
Will depend on your db, the following will work in Access

e.g. select top 1 yourid from yourtable
order by rnd(yourid)

in sql server it doesn't work the same and the code will return only the minimum id although I'm sure there is a way

Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top