jeudi 1 novembre 2018

TSQL - Random winner for multiple locations based on weight

Our company does a drawing every month for "customer of the month". The drawing is basically a weighted drawing based on how much the customer spent that month.

Currently I am getting the customer name and their amount of points and running it through an Excel randomizer I found online. This becomes cumbersome doing it individually for 40+ locations every month.

I am going to appologize becuase I have seen some other questions about this but i just cant wrap my head around writing the TSQL to choose the random weighted winner.

Obvisously it would be nice if a single command could output me a random winner for each location, but im having difficulty finding out where to start and ensuring that its choosing the weighted winner correctly.




Aucun commentaire:

Enregistrer un commentaire