I am trying to find the keyword "img" in the duplicate values in my SQL database using the answer in this post: Finding duplicate values in a SQL table. I want to select those duplicate values in my database that have a "img" keyword in either of 'question', 'option' or 'solution' column.
My SQL statement looks like this:
SELECT
`subject`, `topic`, `sub_topic`, `difficulty`,`question_number`,`question_version`, COUNT(*)
FROM
`qz_question`
GROUP BY
`topic`, `sub_topic`, `difficulty`,`question_number`,`question_version`
WHERE
`option` LIKE '%img%' OR `question` LIKE '%img%' OR `solution` LIKE '%img%'
This returns me this 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 'WHERE `option` LIKE '%img%' OR `question` LIKE '%img%' OR `solution` ' at line 7
How do I correct this error? Need some guidance on this.