Click here to Skip to main content
15,908,776 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Pls some one tell that how to fetch the values from one single table like i have fields....

id    name       juniormanagerid   seniormanagerid
1     sachin          2                   1
2     dhoni           4                   1
3     rena            2                   2
4     Malik           3                   3
5     suraj           4                   2




Pls some one tell that how to fetch data of juniormanagerid and seniormanagerid.

I dont know the solution pls some one help......

[edit]Code block added - OriginalGriff[/edit]
Posted
Updated 2-Dec-13 3:48am
v2
Comments
Kornfeld Eliyahu Peter 2-Dec-13 9:23am    
Are you on the way to learn SQL?
phil.o 2-Dec-13 9:23am    
Not clear at all.
What do you need exactly? Where are you stuck?
Please post the code you got so far (a relevant portion of your code, not your whole project).
Thanks :)
thatraja 2-Dec-13 9:24am    
Still your question is confusing. Include the output(which you want) in your question.
gvprabu 2-Dec-13 11:09am    
hi.. share the current data... wht you have in ur table?
gvprabu 2-Dec-13 11:15am    
how sachin(1) his sr.mng.id is sachin (1)? explain clearly

1 solution

If you are looking to display the hierarchy (A is managed by B, B is managed by C) then this article outlines the tools available in a number of database enqines:

Recursion in SQL - Wikipedia

And this link shows how to solve a similar (I think) problem to yours:

Example answer on Stack Overflow
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900