As far as I know, in Rails it should be possible to do the following:
ActiveRecord::Base.connection.select_all("SELECT MONTH(created) AS month, YEAR(created) AS year FROM orders WHERE created>=$1 AND created<=$2 GROUP BY month ORDER BY month ASC",nil,[['created',1],['created',2]])
but unfortunately this doesn't work at all. in any format I'm trying to use, $1 and $2 never replaced with the corresponding values ββfrom the bind array.
Is there anything else I should take care of?
source share