A way to create a recursive query that repeats itself until until it's termination point. Apparently mysql doesn't support WITH RECURSIVE.
WITH RECURSIVE my_cte AS
(
SELECT 1 AS n
UNION ALL
SELECT 1+n FROM my_cte WHERE n<10
)
SELECT * FROM my_cte;