如果我这样做
self.order("extract(year, day), extract(month, day)")
我得到了
ActiveRecord::StatementInvalid: PG::Error: ERROR: syntax error at or near "DESC"
LINE 19: ...>= '08-01-2012') GROUP BY 1 ORDER BY extract(year DESC, day)...
有没有办法用activerecord正确格式化这个查询?
答案 0 :(得分:0)
你试过做错误建议你做的事情:
extract(year DESC, day)