大于值1的SQL查询将无法正常工作?

时间:2014-09-12 15:58:16

标签: mysql

我试图退出:

question_id,question_body,answer_value

 如果answer_value大于1,但它不起作用?

SELECT answers.question_id, question_body, answer_value FROM answers 
LEFT JOIN questions on answers.question_id = questions.question_id 
where question_sort=1 AND form_id=1479043482602207 WHEN answer_value=>1

1 个答案:

答案 0 :(得分:2)

尝试以下方法:

SELECT answers.question_id, question_body, answer_value FROM answers 
LEFT JOIN questions ON answers.question_id = questions.question_id 
WHERE question_sort=1 
AND form_id=1479043482602207 
AND answer_value >= 1

“大于或等于”的正确语法是'> ='。

你也应该使用另一个'AND'而不是'WHEN'。