MySQL Forums
Forum List  »  Quality Assurance

Using RAND for Multiple Rows
Posted by: Steve K
Date: February 16, 2008 10:44PM

I want to use RAND to update certain values in the database. I want to do something like this,

UPDATE table SET value = IF(@RAND_VALUE=RAND() < 0.1, 0,
@RAND_VALUE < 0.2, 1,
@RAND_VALUE < 0.3, 2, 3);

The problem I am having is that I need a unique value for every row in the table and embed the assignment in the SQL statement.

Any suggestions?

Options: ReplyQuote

Written By
Using RAND for Multiple Rows
February 16, 2008 10:44PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.