id, parent_id, category_name from t where parent_id IS NULL UNION ALL select s.id, s.parent_id, s.category_name as parent from t as s, r where r.id = s.parent_id ) search depth first BY id set ordcol SELECT r.parent, r.category_name as name FROM r WHERE r.parent_id i not null ORDER BY ordcol; UNCOVERTRUTH Tech sake #2 28