我有以下find_by_sql并且收到“参数太少”错误。有什么想法要修复吗?想把它保存为find_by_sql
dates=find_by_sql(['select DATE(start_datetime) date_only, DATE_FORMAT(start_datetime,\'\%b \%D\') as formatted_date from events where area_id=1 group by date_only'])
THX
答案 0 :(得分:1)
您需要使用双百分比符号来转义取景器内的百分比:
dates = find_by_sql(['select DATE(start_datetime) date_only, DATE_FORMAT(start_datetime,\'\%%b \%%D\') as formatted_date from events where area_id=1 group by date_only'])