表内关联

Inner Join

SELECT column_list
FROM t1
INNER JOIN t2 ON join_condition1
INNER JOIN t3 ON join_condition2

WHERE where_conditions;

Example

id name parentid
1 北京市 0
2 海淀区 1
3 北京xx大学 2

select a.name 市,b.name 区,c.name 名
from address a
join address b on b.parentid = a.id
join address c on c.parentid = b.id
join address d on d.parentid = c.id