Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: SQL: When would I want to join a table with itself ?
In article <bh8cpo$10r$1_at_slb0.atl.mindspring.net>, newsgroup-responses-1
@waycoolgear.com says...
> SQL: When would I want to join a table with itself ? Example please ?
> Thanks for any help!
The most common one we use is an organisational structure table:
org_unit_id org_unit_desc org_unit_parent 1 Head Office 0 2 Branch A 1 3 Sub Branch X 2 4 Branch B 1 5 Agency 543 3 6 Agency 987 4
Use a self-join to find the "parent" of a unit, or its children.
Geoff M Received on Mon Aug 11 2003 - 17:59:51 CDT