Self-Join (T-SQL)


You can use self-join to get some business result from a query like demonstrated in this MSDN documentation.
http://technet.microsoft.com/en-us/library/ms177490(v=sql.105).aspx
But it may have other issues if your are running self-join query with large table in a OLTP environment:
http://weblogs.sqlteam.com/jeffs/archive/2007/06/12/using-group-by-to-avoid-self-joins.aspx
http://sqltouch.blogspot.com/2013/07/self-join-incurs-more-io-activities-and.html

I’ll come back to this topic later.

Advertisements


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s