1
以下查询需要改变什么?我希望所有那些date_of_leaving为空或date_of_leaving在过去60天之间或date_of_leaving大于或等于Date.today或当前日期的员工。获取错误,Mysql2 ::错误:你的SQL语法在rails中有错误?
employees = @company.employees.where('date_of_leaving BETWEEN ? AND ? OR date_of_leaving IS NULL OR date_of_leaving IS >= Date.today', Date.today - 60, Date.today)
我以另一种方式尝试,如下图所示。
employees = Company.find(4).employees.where('date_of_leaving BETWEEN ? AND ? OR date_of_leaving IS NULL OR date_of_leaving IS >= ?', Date.today - 60, Date.today,Date.today)