PDA

View Full Version : NewId()



pucca
March 27th, 2006, 09:14 AM
I want to random select 5 records from my database.. I got this code,


SELECT Top 5 * FROM comptbl ORDER BY NewID()

but its gives me an error saying "Undefined function 'NewID() in expression."
What must I do?

thanks for the help! :puzzled:

JoshuaJonah
March 27th, 2006, 09:25 AM
I think you are looking for the rand() function. Look here (http://ca.php.net/manual/en/function.rand.php).

you can use that to got a random number in certain range then combine that with your MySQL select statement.

pucca
March 27th, 2006, 10:07 AM
sorry man, but the sites actually done in asp. It's a access database?.... Don't know asp that well?...:(