We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,478 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

sql query get random data

i have this query:

$item_query = mysql_query("SELECT * FROM item");

this will always get the data from 1st row to bottom row.

how can i get random data?

SELECT * FROM item  ORDER BY RAND()
or
SELECT * FROM item ORDER BY NEWID()

i want the best way to get random data.

2
Contributors
1
Reply
1 Hour
Discussion Span
5 Months Ago
Last Updated
3
Views
Question
Answered
hwoarang69
Posting Pro
569 posts since Feb 2012
Reputation Points: 6
Solved Threads: 0
Skill Endorsements: 7
pritaeas
Posting Prodigy
Moderator
9,316 posts since Jul 2006
Reputation Points: 1,178
Solved Threads: 1,467
Skill Endorsements: 86
Question Answered as of 5 Months Ago by pritaeas

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0577 seconds using 2.66MB