I would like to generate the following output, using a single row from a select.
SELECT max(t1.id)+1 as new_id FROM t1;
-> 101
However I want to do
SELECT s.last_id, sequence(1..100000000) as new_id
FROM (SELECT max(table1.id)+1 as last_id FROM table1) s;
-> 101,1
-> 101,2
-> 101,3
......
-> 101,100000000
In postgreSQL I can do this using:
SELECT s.last_id, generate_series(1,100000000)
FROM (SELECT max(table1.id)+1 as last_id FROM table1) s; -- returns 100,000,000 rows
How do I do this in MySQL without using a temp-table?