嵌套更新
UPDATE users u
INNER JOIN users r ON r.`id` = u.`referId`
SET u.grade = (r.`grade` + 1)
WHERE
u.`grade` IS NULL
AND r.`grade` IS NOT NULL
AND u.`id` != 1
嵌套更新
UPDATE users u
INNER JOIN users r ON r.`id` = u.`referId`
SET u.grade = (r.`grade` + 1)
WHERE
u.`grade` IS NULL
AND r.`grade` IS NOT NULL
AND u.`id` != 1