zcm_users 表中有个parent_id字段,更新子节点(low_extension_num )的值
UPDATE zcm_users AS a
SET a.low_extension_num = IFNULL( (
SELECT t.count FROM
( SELECT parent_id, COUNT(*) count FROM zcm_users GROUP BY parent_id) t
WHERE t.parent_id = a.id
), 0 )