The following works as expected when a single value is stored in a variable:
Set @var = 121;
select * from table where id = @var;
How to set a variable with multiple values and then use it in a query. I tried this, but it does not work:
set @var = (
117,120,121,122,143,151,175,233,387,189,118,119,339,357,500,501,493,425,307,191,
117,120,121,122,143,151,175,233,387,189,118,119,339,357,500,501,493,425,307,191,
117,120,121,122,143,151,175,233,387,189,118,119,339,357,500,501,493,425,307,191
)
select * from table where id = @var;