I have a query that uses a variable in its where clause:
SET @id = 1;
SELECT
id,
value
FROM myTable
WHERE id = @id;
I would like to run the query for @id values 1 through 100, and then union (or somehow combine) all the loop results into one result set. Is this possible in MySQL, and if so, what is a good approach?