MySQL SET random value? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: MySQL SET random value? (
/showthread.php?tid=624277)
MySQL SET random value? -
rOps - 13.12.2016
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.
Re: MySQL SET random value? -
Yaa - 13.12.2016
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
Re: MySQL SET random value? -
Konstantinos - 13.12.2016
http://stackoverflow.com/a/24378552
Re: MySQL SET random value? -
Yaa - 13.12.2016
Quote:
Originally Posted by Konstantinos
|
Nice 1 @Konstantinos
didn't know about it