Hello,

I have a question:

Suppose I have a table named as tblfriends and there are 3 columns with several row. Column names are: name, email, phone

I want to pick 5 names randomly from the table each time my asp page refreshes.


How can this be coded in classic asp?

Thanx for your help

Recommended Answers

All 2 Replies

use this as your query
SELECT TOP 5 name FROM tblfriends
ORDER BY NEWID()

Random:

SQL Server:
SELECT TOP 5 name FROM tblfriends
ORDER BY RAND()

MySQL:
SELECT name FROM tblfriends
ORDER BY RANDOM() LIMIT 5

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.