MySQL 同一个表 left join 三次

 

 

一个表连续 left join 三次

 

SELECT `PNode`.`id`, `PNode`.`name`, `PNode`.`title`,`PNode`.`pid`,`SubNode`.`id`, `SubNode`.`name`, `SubNode`.`title`,`SubNode`.`pid` ,`ThdNode`.`id`, `ThdNode`.`name`, `ThdNode`.`title`,`ThdNode`.`pid`  FROM `hd_node` AS `PNode` left join `hd_node` AS `SubNode` on `PNode`.`id` = `SubNode`.`pid`  left join `hd_node` AS `ThdNode` on `SubNode`.`id` = `ThdNode`.`pid` where  `PNode`.`pid` = 0  order by  `PNode`.`pid`

 

你可能感兴趣的:(mysql,自身left join 多次)