使用UNION ALL生成一个包含重复序列的临时表。SELECT 1 AS num UNION ALL
SELECT 2 AS num UNION ALL
SELECT 3 AS num UNION ALL
...
SELECT N AS num这里的N是你想要填充的重复序列的长度。
使用LEFT JOIN将原始表与临时表连接起来,以填充空白。SELECT t1.num, t2.column_name
FROM (SELECT 1 AS num UNION ALL
SELECT 2 AS num UNION ALL
SELECT 3 AS num UNION ALL
...
SELECT N AS num) AS t1
LEFT JOIN your_table AS t2 ON t1.num = t2.column_name这里的your_table是你要填充的表名,column_name是你要填充的列名。
如果你想要填充的是多个列,可以在连接条件中添加多个列名。SELECT t1.num, t2.column_name1, t2.column_name2, ...
FROM (SELECT 1 AS num UNION ALL
SELECT 2 AS num UNION ALL
SELECT 3 AS num UNION ALL
...
SELECT N AS num) AS t1
LEFT JOIN your_table AS t2 ON t1.num = t2.column_name1 AND t1.num = t2.column_name2 AND ...