【发布时间】:2010-07-28 05:18:58
【问题描述】:
自从我使用相关子查询以来已经有一段时间了,我不确定我这样做是否正确。在我的子查询第二行最后一行中,我试图从外部表中获取node.id。当我尝试执行查询时,我得到了
错误代码:1054 未知列 'where 子句'中的'node.id')
select node.id, node.title, depthLookup.depth
from posts node, (
select count(parent.title) as depth
from posts parent, posts children
where children.lft > parent.lft
and children.rgt < parent.rgt
and children.id = node.id
order by parent.lft
) as depthLookup;
【问题讨论】:
标签: mysql sql mysql-error-1054