S
shripaldalal
Hi,
I am using MS Access / Jet.
Problem is of hierarchial query:
I mean typical Boss Employee table:
Name Boss
===== =====
John NULL
Sam John
Michael Sam
William Sam
Alfred William
I need a query that if I take John then all names should be returned
in a single coulmn because he is the highest boss, if i take sam, then
michael, william and alfred should be returned. If I take Michael then
only Michael should come since no one is working under him.
Ok, one boss can have many employees and no employee will have two
bosses, that's for sure. atleast in my table that's the way I have
kept it.
So I want to start on top and go to the bottom, not start from bottom
and go to the top.
Can a single SQL statement do this ? It will save a lot of trouble.
I want unlimited levels.
Best regards,
Shripal Dalal.
I am using MS Access / Jet.
Problem is of hierarchial query:
I mean typical Boss Employee table:
Name Boss
===== =====
John NULL
Sam John
Michael Sam
William Sam
Alfred William
I need a query that if I take John then all names should be returned
in a single coulmn because he is the highest boss, if i take sam, then
michael, william and alfred should be returned. If I take Michael then
only Michael should come since no one is working under him.
Ok, one boss can have many employees and no employee will have two
bosses, that's for sure. atleast in my table that's the way I have
kept it.
So I want to start on top and go to the bottom, not start from bottom
and go to the top.
Can a single SQL statement do this ? It will save a lot of trouble.
I want unlimited levels.
Best regards,
Shripal Dalal.