How to make the IN operator normally perceive the data contained in the @ids variable?
SELECT @ids:= 63,62,12,243,237; SELECT * FROM talbe_name WHERE id IN (@ids); How to make the IN operator normally perceive the data contained in the @ids variable?
SELECT @ids:= 63,62,12,243,237; SELECT * FROM talbe_name WHERE id IN (@ids); Is the output of the command SELECT @ids:= 63,62,12,243,237; did not make you think and did not cause the desire to display the resulting variable on the screen?
And even a non-working request did not cause a desire to display a variable on the screen?
In case of any problems with the code, the programmer must check the contents of all variables.
For the current problem setting, the numbers must be enclosed in quotes, and the IN replaced by FIND_IN_SET() .
But most likely the original problem is solved in a completely different way, and for this you need to know where it came from, but this will be a separate question.
Source: https://ru.stackoverflow.com/questions/423257/
All Articles