2010-06-30 44 views

回答

4
User.find(:all, :conditions => ["LENGTH(last_name) < ?", 3]) 

,或者您可以使用find_by_sql

User.find_by_sql("SELECT * FROM users WHERE LENGTH(users.last_name) < 3")