In MySQL, SELF JOIN
is used to combine rows with other rows in the same table. In other words table is joined with itself. This can be achive with the help of table alias to distinguish the left table from the right table of the same table in a single query.
To combine rows with other rows in the same table, use the following syntax:
Parameters:
tablename1: The table name from which you want to fetch records.
col1: The column or field name that will be return.
SELF JOIN
:Note:
In the above example, we are combining rows with other rows in the same table using SELF JOIN
.
You can use MySQL Command Line Client to combine rows in the same table.