0

I am using MySQL 5.6 , one of my table field contains JSON data. I am getting syntax error when using below query -

SELECT * FROM products WHERE device_id = '1212'and product_id = '54'and option = '"{"229":"20"}"'

field option has value as {"229":"20"} I am getting following error -

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'option = '"{"229":"20"}"'
LIMIT 0, 25' at line 1 

Please suggest any solution , thanks much!!!

1 Answer 1

5

option is a reserved keyword in MySQL. Use backticks to escape it or choose a different name

... `option` = ...
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.