update category as a INNER JOIN category AS b ON a.parent_id = b.cat_id AND b.parent_id=0 set a.level = 2