Rails将计算字段添加到多个表的连接中

时间:2013-03-14 07:59:23

标签: ruby-on-rails join

我确实加入了三张桌子。

  

arel = OfferOrder.includes(:a,:b,:c)    arel = arel.select('(CASE WHEN ISNULL(c.field2)那么c.field1 ELSE c.field2 END)AS欺诈')

但是当我运行我的代码时,它会给出错误

(Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AS fraud)

我哪里出错?

0 个答案:

没有答案