Question

I have the following find_by_sql and am getting a 'too few arguments' error. Any ideas to fix? Would like to just keep it as a 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

Was it helpful?

Solution

You need to use double percentage symbols to escape a percentage inside of a finder:

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'])
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top