Tech News

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;
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x