Hi,
Why does the following query work, when there is no column named Agentid in the "NewAccounts"-CTE?
WITH
NewAccounts AS (
SELECT 3 as Newaccountid
),
MovedAUM AS (
SELECT 1 AS Agentid, 2 as Col2
)
SELECT * FROM MovedAUM WHERE agentid IN (SELECT Agentid FROM NewAccounts)
The following, modified query returns the error message as expected:
WITH
NewAccounts AS (
SELECT 3 AS newaccountid
)
SELECT Agentid FROM NewAccounts