Home » SQL & PL/SQL » SQL & PL/SQL » sql problem
sql problem [message #211482] Thu, 28 December 2006 23:02 Go to next message
royamarnath
Messages: 21
Registered: November 2005
Junior Member
Hi..i am having a problem in sql query.
suppose i have the following table which contains emp id and manager id

table name - emp

empid mgrid
--------------------
1 2
3 2
5 2
6 3
7 3
8 5
9 8


now i want to retrieve all the emp under a particular manager.
suppose if i give 3 then it will show 6,7 [6,7 are the emp under 3] ....if i give 2 in sql query then it will show 1,3,5,6,7,8,9 [2 is the superior manager here]

i hope i can make u understand the problem.. i need this output in one sql query. is it possible?


please help me regarding this
thanks

amarnath








Re: sql problem [message #211485 is a reply to message #211482] Thu, 28 December 2006 23:16 Go to previous message
rleishman
Messages: 3724
Registered: October 2005
Location: Melbourne, Australia
Senior Member
Do a search on CONNECT BY, or look in the doco.

Ross Leishman
Previous Topic: Create Materialized View in Oracle 9.2.0.5
Next Topic: Need help in Using UTL_FILE package
Goto Forum:
  


Current Time: Sun Dec 11 02:24:24 CST 2016

Total time taken to generate the page: 0.08756 seconds