Wednesday 15 July 2015

Can anyone please help me with this SQL Query (works in SQLite DB Browser, but not in Rails) -


Rails are spitting on me:

  SQLite3 :: SQLException: near " Select ": Syntax Error: Select questions.id, questions.text, questions.question_type_id, questions.meta, questions.max_answer_length, COUNT (form_questions.id) as expr1, (5) as expr2, Cast (in the form of COUNT (form_questions.id)) / cast ((5) as real) question, form_questions expr3 where form_questions.question_id = questions.id questions.id, questions.text, questions.question_type_id, questions .meta, questions.max_answer_length being expr3 by Group & Gt; = COUNT command (form_questions.id) DESC;  

The query executes the SQLite database correctly with no problems in the browser, but for some reason the railways will speak on it.

The code is:

  select self.find_by_commonality Question.find_by_sql (% & questions.id, questions.text, questions.question_type_id, questions.meta , Questions.max_answer_length, COUNT (form_questions.id) as expr1, expr2, cast (COUNT as real (form_questions.id) as real (5)) / cast ((5) in the form of real) In expr3 question, where form_questions.question_id = questions.id from group form_questions questions.id, questions.text, questions.question_type_id, questions.meta, questions.max_answer_length having expr3> = 0.75 order by COUNT (form_questions.id) DESC; & amp;% []) End  

WTF is complaining about it

There is a dot in front of the selection statement, is that it must be definitely ?


No comments:

Post a Comment