U
U
uuuu2020-04-16 01:54:15
MySQL
uuuu, 2020-04-16 01:54:15

How to use variable in MySql?

There is a small table consisting only of numbers.

SET @TEMP  := (SELECT group_concat(id) FROM world WHERE account=8);


Next, the @TEMP variable must be used in IN ().
IN (as far as I know) accepts values ​​separated by commas, so I used group_concat(id). But in the end only one value is returned

Answer the question

In order to leave comments, you need to log in

1 answer(s)
U
uuuu, 2020-04-16
@uuuu

And here is the answer:
You can do without the variable and group_concat().
You can immediately in IN (SELECT id FROM world WHERE account=8)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question