NArc0t1c Posted September 10, 2007 Share Posted September 10, 2007 Hello. I'm sitting here with a problem I cannot seem to pass. What I am trying to do is select data from row, ordered by it's rank. So, that means, the higher the rank, the more likeley it will be picked. Here is my query sofar; select `id`,`name`,`image`,`url`,`mid`,`status` FROM `people` where `status`='1' order by rand(`rank`) limit 1 I have read the mysql documentation of the rand function, but I don;t know/can't find info on this. Is it maybe that it can only handle numbers, if so, won't it return a number in any case. The type of `rank` is int and set to 10 characters. Edit: Oh yes.., the error; #1210 - Incorrect arguments to RAND I really need help on this. Thanks Ferdi Quote Link to comment Share on other sites More sharing options...
fenway Posted September 11, 2007 Share Posted September 11, 2007 That's impossible to do with the RAND() function alone... it can only take a seed for the random number generator. You'd need to "group" them into bins, then pick a random one from the highest "bin". Quote Link to comment Share on other sites More sharing options...
NArc0t1c Posted September 12, 2007 Author Share Posted September 12, 2007 That's impossible to do with the RAND() function alone... it can only take a seed for the random number generator. You'd need to "group" them into bins, then pick a random one from the highest "bin". Thankyou, fenway. I will do that. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.