The following code executes as expected. However, the editor shows red lines under attribute5 and WCC_ID in "h.attribute5 = i.WCC_ID" and states "Invalid column name" when the mouse hovers over the red lines. These columns exist in the respective tables.
What is wrong with the SQL?
SELECT
*
FROM
(
SELECT attribute5
FROM
OPENQUERY([FAMISPRO.WORLD],'SELECT attribute5 FROM FAMIS_EMP')
) AS h
INNER JOIN
(
SELECT DISTINCT h.WCC_ID, h.KEYMARK
FROM
OPENQUERY ( PROJECT ,'SELECT * FROM ENTRY;' ) AS h
LEFT JOIN
(
SELECT *
FROM
OPENQUERY ( PROJECT ,'SELECT * FROM ENTRY;' )
WHERE
EVENT = 'RETURNED'
) AS i
ON
h.WCC_ID = i.WCC_ID AND h.KEYMARK = i.KEYMARK
WHERE
i.EVENT IS NULL
) AS i
ON
h.attribute5 = i.WCC_ID;