SQL Query

Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
SpaceshipSpaceship
Watch

boomers

Established Member
Impact
4
Is there a way to select a random record from within an SQL database?
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Might try looking at the mysql.org website.

I cant think of one off hand though.

You could create a php/js script that generated random numbers, and have it feed those into a variable for calling record numbers....
 
0
Close
0
Close
Which DBMS? If you're talking about MS SQL, do a order by newid() trick ;)

"select * from sometable order by newid()"

If you're talking abouit MySQL use rand:

"select * from sometable order by rand()"
 
0
Close
If you're looking to select just one record do this query

Code:
select * from table where some_key = rand()
 
0
Close
CatchedCatched

We're social

Escrow.com
Spaceship
CryptoExchange.com
Domain Recover

NamePros updates

Quick replies: search, your most used replies, and more on every post
Quick replies are easier to find and use now. The quick reply menu has a search box. Type a few letters to find the reply you want. A...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back