mardi 5 septembre 2017

Better method to find the second largest element in ruby on rails active record query

I am using this query to find the 2nd largest element. I am making query on value column.

Booking.where("value < ?", Booking.maximum(:value)).last

Is there any better query than this? Or any alternative to this

Aucun commentaire:

Enregistrer un commentaire