如何在Rails查询中使用STR_TO_DATE函数?

时间:2014-06-09 07:39:20

标签: mysql ruby-on-rails

Ruby on Rails 4 + Mysql

这是mysql中的一个查询工作正常。

select * from `schedules` 
WHERE (STR_TO_DATE(departure_time,'%h:%i%p') >= TIME(NOW()) and travel_date ='2014-06-09' and origin_id ='134' and destination_id ='251' and operator_id not in (SELECT id FROM `operators` WHERE (status != 'Active')) and status ='Active' and available_seats > 0)
ORDER BY STR_TO_DATE(departure_time,'%h:%i%p'); 

这个查询我想写在Rails中。如何给这一个`ORDER BY STR_TO_DATE(departure_time,'%h:%i%p')';在rails 4任何建议/提示......

0 个答案:

没有答案
相关问题