Reprence Html CSS javascript PHP MySQL Bootsrap

MySQL Self Join

A self join is a regular join, but the table is joined with itself.

Self Join Syntax

102

T1 and T2 are different table aliases for the same table.



Demo Database

In this tutorial we will use the well-known Northwind sample database.

Below is a selection from the "Customers" table:

103

MySQL Self Join Example

The following SQL statement matches customers that are from the same city: