Rails查询以查找employee表中的第二高薪

rub*_*ist 1 ruby-on-rails

我有一个员工模型,员工表中会有一些带有薪水栏的记录.我需要找到第二大员工薪水的记录我怎么能用简单的铁路查询呢?

And*_*ton 7

Employee.order(salary: :desc).offset(1)
Run Code Online (Sandbox Code Playgroud)