我有这个:
SectionHistory.find(:all, :conditions => ["id=? and (name!=? or code!=?)", sec.id, sec.name, sec.code])
我收到错误““and (name!=? or code”后面的字符“!”无效”
如果我的条件字符串只是“id=?和(name!=?)”就可以了
我们正在使用 DB2。
对此有什么建议吗?
谢谢
最佳答案
这是 SQL;尝试:
"id=? and not (name=? and code=?)"
关于ruby-on-rails - ActiveRecord 条件错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/722187/