怎么关联同一个表里的字段
有3个字段的表如下
id superid name
1 4 aaa
2 5 bbb
3 ccc
4 ddd
5 eee
这里superid是id的父节点,我想要的查询结果是
id supername name
1 ddd aaa
2 eee bbb
3 ccc
4 ddd
5 eee
------解决方案--------------------SELECT t1.id,
(SELECT t2.name FROM t_table t2 WHERE t2.id = t1.superid) supername,
t1.name
FROM t_table t1
------解决方案--------------------select t1.id,t2.name,t1.name from table t1,table t2 where t1.superid=t2.id(+)