0

我正在尝试为我拥有的应用程序数据创建一个临时表。当我运行子查询时它工作正常但是当我在临时表参数中运行它时它失败了

错误代码:1054。“where 子句”中的未知列“getApplicationsForRespID.app_id”

CREATE TEMPORARY TABLE CurrentApplications ENGINE=MEMORY AS 
(
SELECT *, planning_scheme.markus_ra, planning_scheme.metro_or_rural
FROM application
INNER JOIN key_table ON key_table.app_id = application.app_id
INNER JOIN planning_scheme ON planning_scheme.ps_code = application.planning_scheme

CROSS JOIN 
(
    SELECT key_table.app_id AS app_id2, planning_return.resp_authority AS resp_id
    FROM key_table
    INNER JOIN planning_return ON key_table.return_id = planning_return.return_id

)getApplicationsForRespID

WHERE application.app_id = getApplicationsForRespID.app_id
AND key_table.is_current = 1

)

4

1 回答 1

2

在您的交叉连接子查询中,您有key_table.app_id AS app_id2,这意味着不getApplicationsForRespID.app_id存在任何字段。

getApplicationsForRespID.app_id2改为在WHERE子句中使用!

于 2013-05-31T02:29:33.833 回答