Related Posts Plugin for WordPress, Blogger...

About

Follow Us

Showing posts with label Self join. Show all posts
Showing posts with label Self join. Show all posts

Thursday, 19 February 2015

A self-join is a query in which a table is joined (compared) to itself.   So basically this join is always performed on single table as opposed to other joins that need more than one table.  Self-joins are used to compare values in a column with other values in the same column in the same table.
To write the self join query we use a table twice in FROM clause and assign different alias to each instance of table  because tables participating in self join have same name.