July 24, 2008 at 2:26 pm
Hi Friends
Can Someone Explain me SelfJoin With a Simple Example.
July 24, 2008 at 2:52 pm
create table dbo.SelfJoin (
ID int identity primary key,
ParentID int null references dbo.SelfJoin(ID))
That's a self-join (one type, anyway). It's just a table that joins to itself.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
July 24, 2008 at 3:30 pm
select a.value, b.value
from tableA a
inner join tableA b
on a.id = b.parentid
July 27, 2008 at 1:33 am
Check this kb for your question,
http://databases.about.com/od/sql/a/selfjoins.htm
Thanks and Regards,
Venkatesan Prabu, 😛
My Blog:
http://venkattechnicalblog.blogspot.com/
July 28, 2008 at 4:50 am
ALOT of stuff on the net. Check this out...
http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/">
http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/
Atif Sheikh
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply