我试图通过调整@s:= 1和@ s< 1000来向表中插入不同数量的行,但它一次只插入一行。我做错了什么?
INSERT INTO
rent
(
id
)
select @s:=@s+1 as seq
FROM (SELECT @s:=1) AS baseview, rent
WHERE @s<1000
ORDER by @s ASC;
答案 0 :(得分:0)
你能试试吗?:
INSERT INTO
rent
(
id
)
SELECT seq FROM (
select @s:=@s+1 as seq
FROM (SELECT @s:=1) AS baseview, rent
WHERE @s<1000
ORDER by @s ASC
) seqSource;