开发者

ActiveRecord query help .count

开发者 https://www.devze.com 2022-12-20 08:30 出处:网络
I have a DB table users that has the following columns: id, clan_id, experience I want to run a开发者_Go百科 query using rails that returns the top 50 clans based on experience.How would you do this

I have a DB table users that has the following columns: id, clan_id, experience

I want to run a开发者_Go百科 query using rails that returns the top 50 clans based on experience. How would you do this query in rails?

Clan Table to User Table is a one to many relationship. Thus a clan is composed of multiple users that have the same id.


Clan.find(:all, :order => "experience DESC", :limit => 50)
0

精彩评论

暂无评论...
验证码 换一张
取 消