Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: When would I want to join a table with itself ?
"Terry Dykstra" <dontreply_tddykstra_at_forestoil.ca> wrote in message news:<5UOZa.69378$JT2.1606675_at_news2.telusplanet.net>...
> The standard example: employee table that has the employeeid and managerid.
> To get the employees reporting to a manager you need a self join.
>
> > SQL: When would I want to join a table with itself ? Example please ?
> > Thanks for any help!
> >
In general, any query that requires scalar data from more than one
row of the table to show up in every single resultset row is a prime
candidate for a self-join.
( Or one of the functions that do it for you, like LAG, RANK, etc.)
Cheers
Nuno Souto
wizofoz2k_at_yahoo.com.au
Received on Mon Aug 11 2003 - 22:13:01 CDT
![]() |
![]() |