0

I have works table, with columns id, employer_key, task_key, etc. The task_key column contains task keys such as 122,142, or just one key 124, or more.

My problem is when I do the query:

"SELECT * FROM works WHERE 122 IN(task_key)"; 

The query works only if the 122 is the first number listed, but if I search for 142, the second number listed, I don't get any result. Does anyone know why?

0

1 Answer 1

1

You probably should change your schema but to do what you want you can use FIND_IN_SET()

SELECT * 
FROM works 
WHERE FIND_IN_SET('122',task_key) > 0
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.