Skip to Content

How to Create a Ranking System

At some point you may want to create a ranking system if you would like leaderboards or points associated with columns you want to display. An example is where you want to display Employees ranked by number of points they've generated by an activity.

If you want to create a ranking system in your Vinyl application, you will need to escape Vinyl and use SQL with the following syntax: ${RANK() OVER (ORDER BY {{Sum}} DESC)}. In this example, Sum is the column we want to sort by in the rank, and we indicate a descending order with DESC.

Resources