Kaleb Kaleb - 4 years ago 100
SQL Question

Multi-part identifier could not be bound but no join issue?

I'm running the below on MS Server Management studio v11.02
However' I'm getting an error saying that the:

The multi-part identifier "PO.LastPo" could not be bound.


Any ideas what I can do to solve this?

SELECT DISTINCT PO.LastPo
INTO #IncludedPoll
FROM
(
-- Inner query makes sure member was actually enrolled for 2 yrs
SELECT LastPo, COUNT(*) AS Periods
FROM [Cye].[2_output_lastPoll] PO
WHERE PO.PollPq IN (1,2)
GROUP BY LastPo
) A
WHERE Periods IN (1,2) AND A.LastPo NOT IN (SELECT LastPo FROM #FilterPoll)


#FilterPoll
is a temporary table, which I get fine and contains some IDs that I want to filter out of the
#IncludedPoll
temporary table.

I've looked at other answers around this but they all relate to joins, which should not be a problem here.

Answer Source

You named your inner query A, so it should be SELECT DISTINCT A.LastPo instead of PO.LastPo

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download