我在MySQL中运行以下查询
REPEAT
INSERT IGNORE INTO tableB
SELECT a.column_name, a.level+1
FROM tableA AS a
UNTIL Row_Count() = 0 END REPEAT;
但我想对它设置一个限制,以便在a.level超过10(或者是Row_Count()= 0)时停止重复。我该怎么做?
答案 0 :(得分:1)
REPEAT
INSERT IGNORE INTO tableB
SELECT a.column_name, a.level+1
FROM tableA AS a
WHERE a.level <= 10
UNTIL Row_Count() = 0 END REPEAT;
或者我没理解。