Click here to Skip to main content
16,011,680 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Let us assume that I have a table (called member) with three coloums: memberid, membername, and memberavatar.
So now, I want to display three random membername each page load.
How can I achieve that?
Thank you. :)
Posted

Try something like this:
SELECT TOP(3) MemberName
FROM Member
ORDER BY NEWID()
 
Share this answer
 
This is so Google question.

I took two most important keywords from your question - "random" and "sql" and Googled the concatenated string.
The very first link answers your question. See it yourself - Google search - random sql[^]

Wasn't that simple?! :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900