I have in database stored how much each users has bought items. I want to add to user dashboard which rank he is, in other words I want variable which will sort table in database who bought most items and give people that rank.
Alex bought 10 items total Elliot bought 12 items total John bought 15 items total
John would gets rank 1. Elliot would gets rank 2. Alex would gets rank 3. etc..
Any idea how to make it?