2

This is what I am trying but it is not working.

SET @myArray = "25,21,90";

SELECT * FROM aTable WHERE bField IN (@myArray);

I end up getting only the results where bField = 25.

Obviously I am asking this because I have a more complex script than the example above. The @myArray may be used multiple times or buried deap in a longer statement.

1 Answer 1

2

You want Find_In_Set:

select * from aTable where FIND_IN_SET(bField, @myArray);
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.