Неверный запрос select name,id,IFNULL(idParent,0) as parentId from good_types where IFNULL(idParent,0)>=0 order by ord