vendredi 16 février 2018

mysql select rand() based on an int cloumn chances

I have a table like this

ID chance
1 1
2 2
3 4
4 1

now I need to choose a rand() from this table

but ID 2 double chances to be selected from ID 4 AND 1

ID 3 four times more chances to be selected from ID 4 AND 1

Easier explanation : Lottery based on chance

sorry for my pure engilsh :(

thanks




Aucun commentaire:

Enregistrer un commentaire