I want to order records based on two columns Arthimatic operation.
Ex: I has two columns on which I has to do an arthimatic operation and sort based on its value. Let the two fields be math, science and total
.And table name is UserMark
. Typically my query looks like this
UserMark.order('(math/total) desc')
This should order the UserMarks based on math/total operation.How could it be done in Ruby on rails?
Aucun commentaire:
Enregistrer un commentaire