Хорошо. Вот как разбираться с «оконными функциями». Если вы используете MySQL 8 +
with
result1 as (
select column1, ROW_NUMBER() OVER (ORDER BY ...) AS rownum1, 0 AS rownum2,
from table1 order by ...
),
result2 as (
select column1, 0 AS rownum1, ROW_NUMBER() OVER (ORDER BY ...) AS rownum2
from table2 order by ...
),
result as (
select * from result1
union all
select * from result2
)
select * from result order by rownum2, rownum1