Use of SQL Self JOIN

Author: Al-mamun Sarkar Date: 2020-04-15 18:22:24

SQL Self JOIN. In this lesson, I will show you how to use SQL Self JOIN on while querying data from the database using the SQL query.

 

SELF JOIN Syntax:

SELECT t1.column, t2.column
FROM table1 t1, table1 t2
WHERE condition;

Example:

SELECT A.name AS name1, B.name AS name2
FROM employees A, employees B
WHERE A.id <> B.id;