The following works as expected when there is a single value stored in a variable:
Set @var = 121;
select * from table where id = @var;
How can I set variable with multiple value and then use it in a query. I have tried this but it doesn't 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;