NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page SQL Query

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search
5 members in live chat ~  


Closed Thread
 
LinkBack Thread Tools
Old 02-17-2006, 12:11 PM THREAD STARTER               #1 (permalink)
NamePros Regular
Join Date: Jun 2005
Posts: 518
boomers has a spectacular aura aboutboomers has a spectacular aura about
 



SQL Query


Is there a way to select a random record from within an SQL database?
boomers is offline  
Old 02-17-2006, 12:24 PM   #2 (permalink)
NamePros Member
Join Date: Feb 2006
Location: Chicago IL
Posts: 73
AllValley is an unknown quantity at this point
 



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....
__________________
Hassle Free Computing and Web Solutions for Personal and Business!
Rochelle Network Communications!
AllValley is offline  
Old 02-17-2006, 02:27 PM   #3 (permalink)
Domains my Dominion
 
sdsinc's Avatar
Join Date: Aug 2005
Location: Web 1.0
Posts: 9,963
sdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatness
 


Third World Education Find Marrow Donors! Find Marrow Donors! Find Marrow Donors! Find Marrow Donors! Animal Rescue Animal Cruelty AIDS/HIV Animal Rescue Wildlife Breast Cancer Animal Rescue Wildlife
Have a look here: http://www.namepros.com/programming/...ght=order+rand
__________________
NameNewsletter.com - free lists of available domain names
ZoneFiles.net (beta) - ccTLD and gTLD droplists
sdsinc is online now  
Old 02-17-2006, 03:20 PM   #4 (permalink)
NamePros Member
Join Date: Feb 2006
Location: Online
Posts: 118
Barts has a spectacular aura aboutBarts has a spectacular aura about
 



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()"
Barts is offline  
Old 02-17-2006, 05:51 PM   #5 (permalink)
NamePros Regular
 
Tree's Avatar
Join Date: Feb 2006
Location: Atlanta, GA, USA
Posts: 335
Tree will become famous soon enoughTree will become famous soon enough
 



If you're looking to select just one record do this query

Code:
select * from table where some_key = rand()
Tree is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Free cPanel, RvSkins, Fantastico, SQL Hosting! dc1pop Web Hosting Offers 0 06-26-2005 07:29 AM
DB Error: Bad SQL Query: DELETE FROM 4images_sessionvars WHERE session_id NOT IN ... none1983 Programming 8 06-02-2005 11:41 AM
Connecting to your SQL Database using Enterprise Manager priyanka[imported] Web Hosting Discussion 1 12-07-2004 03:21 PM
Connecting to your SQL Database using Enterprise Manager priyanka[imported] Webmaster Tutorials 0 12-06-2004 08:58 PM
HELP!!!!!! DB Error? Bad SQL Query? logos The Break Room 5 08-25-2004 07:48 PM

 
All times are GMT -7. The time now is 02:09 PM.

Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger