sql - Query to get hierarchy from a table in Sybase -
i have table following structure:
emp rel_emp relation b 1 c 1 b d 1 b 0 ....
in above table if "rel_emp" child relation "1" if parent relation "0". need write query parent child hierarchy [there can multiple trees in table].
i know how achieve in oracle [by using "connect prior" clause] need in sybase. can please guide me.
p.s: have worked in oracle , dont have idea sybase
you can use self-join here.
self join act of joining 1 table itself.
self join useful convert hierarchical structure flat structure
select e.name employee, m.name manager employee e, employee m e.mgr_id = m.id (+)
for more info.
Comments
Post a Comment