SELECT * FROM g_staff t where find_in_set('201008',
getOrgParentList(t.ORGANIZATION_ID)
getOrgParentList(t.ORGANIZATION_ID)
)
BEGIN
DECLARE sTemp varchar(1000);
declare sTempChd varchar(1000);
set sTemp = '-1';
set sTempChd = nodeId;
label1:LOOP
set sTemp = concat(sTemp,',',sTempChd);
select PARENT_ID into sTempChd from g_organization where ORGANIZATION_ID = sTempChd;
if FOUND_ROWS()=0 or sTempChd is null then
return sTemp;
end if;
end loop label1;
return sTemp;
END