Thursday, 22 May 2014

What is SELF JOIN and when would you use it?


  • The SQL SELF JOIN is used to join a table to itself
  • You use a self join when a table references data in itself.
  • SQL self-join simply is a normal join which is used to join a table to itself.

Example:
SELECT a.column_name, b.column_name...
FROM table1 a,table1 b
WHERE a.common_field = b.common_field;

No comments:

Post a Comment

How to improve applications performance which is hosted in cloud ?

Improving the performance of an application hosted in Microsoft Azure involves a combination of optimizing your application code, leveraging...