Rails:使用大于/小于 where 语句 [英] Rails: Using greater than/less than with a where statement
本文介绍了Rails:使用大于/小于 where 语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试查找 ID 大于 200 的所有用户,但我在特定语法方面遇到了一些问题.
I'm trying to find all Users with an id greater than 200, but I'm having some trouble with the specific syntax.
User.where(:id > 200)
和
User.where("? > 200", :id)
都失败了.
有什么建议吗?
推荐答案
试试这个
User.where("id > ?", 200)
这篇关于Rails:使用大于/小于 where 语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文