我正在使用 SQL Server 2008 并尝试在 SSIS 包数据流任务中编写查询,以根据来自另一个数据库的结果集从一个数据库中读取数据。
我有多个表 A、B、C、D、E 等,我正在尝试编写一个选择来连接这些表并在过滤后获取数据。我在以下查询中收到“无法绑定多部分标识符”错误
SELECT
A.1 as A1,
A.2 as A2,
A.3 as A3,
B.1 as B1,
(Select C.1 from C
left join cc on c.2 = cc.2
where C.x = A.x) as C1,
(Select D.1 from D where D.x = A.x) as D1,
E.4 as E4
FROM A
left join B on B.Y = A.Y
inner join C on C.Y = A.Y
inner join D on D.Y = C.X
left join E on E.Y = D.Z AND E.Z = 'ZZZZ'
WHERE A.P = ?
查询的一般结构如上所示,如果我完全删除 where 子句或给出简单的"WHERE A.P = 'PPPP'"
. 它看起来很简单,我没有使用 where 子句中子查询的任何数据。我究竟做错了什么?