MySQL SET random value?
#1

Hi all. As you see, I want to set for one of the my MySQL tables random value, but I need to set not random (ex. 0, 1, 3, 4). I want to get 1 random value from 4 different values (ex. 2, 11, 5, 9).

Код HTML:
UPDATE `table_name` SET `some_thing` = 'FLOOR(1 + RAND() * 3)' WHERE `thing_some` = '1'
This is bad example, I don't need this, but I need something like this.
Reply
#2

Quote:
Originally Posted by rOps
Посмотреть сообщение
Hi all. As you see, I want to set for one of the my MySQL tables random value, but I need to set not random (ex. 0, 1, 3, 4). I want to get 1 random value from 4 different values (ex. 2, 11, 5, 9).

Код HTML:
UPDATE `table_name` SET `some_thing` = 'FLOOR(1 + RAND() * 3)' WHERE `thing_some` = '1'
This is bad example, I don't need this, but I need something like this.
i don't think it's possible without using pawno or C++ / C#

this is proof : http://www.w3resource.com/mysql/math...d-function.php
Reply
#3

http://stackoverflow.com/a/24378552
Reply
#4

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Nice 1 @Konstantinos

didn't know about it
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)