查询用户ID为1的所有子用户:
select id, name, parent from (select * from tablename order by parent, id) tablename, (select @pv := '1') initialisation where find_in_set(parent, @pv) > 0 and @pv := concat(@pv, ',', id)