I broke my head about this, but couldn't find a solution. Let's take the following example:
There is a game and a user can find stuff. But you can't find all the stuff equally. So there is a table with the items, and thereby a number (let's say between 0 and 5) that will say how much the chance is that this will be found.
So if you have 3 items from 5, 2 and 3:
- First item: 50% chance ( 5/(5+2+3) )
- Second item: 20% chance ( 2/(5+2+3) )
- Third item: 30% chance ( 3/(5+2+3) )
Is this possible with just SQL or do you really need another language like PHP too?