I'm working on a query where users enter in points to a contest. They can enter in as many points as they have. I need to choose a winner at random but people with more points entered should technically have a better chance at getting picked.
I currently pull the query based using rand and a sum of total points per user.
The Table data looks like this:
fname lname user_id points John baker 1 300 Robert backster 2 40 jason Doe 3 900
If I were to run the query multiple times, John would have a better chance then Robert but Jason would have a better chance then both John and Robert.
select * from table order by rand()