1 select t1.code, t1.name, t2.name 2 3 from table t1 4 5 left join table t2 on t1.path = t2.code
非常好的例子。谢谢
楼上正解.....只要再次联查本表,关联path和id就可以了
select table1.code,table1.name,table2.name
from table1
left join table2 on table1.code=table2.path
inner join 也行吧?怎么都left
1L +1
select code, name, (select name from table1 t2 where t2.code= t1.path)
from table1 t1
1楼的答案就不错了。连接比子查询效率高,然后如果用inner join的,山东的这条数据应该是查不出来的~,要用左边的表为主表才行~