Multi-part identifier could not be bound with subquery

  • This is driving me crazy. I've done this before and I can't figure out why I'm getting this error. Can a fresh pair of eyes look at this, please?

    SELECT tb1.[CNN], A.[CRN]

    FROM Table1 tb1

    join

    (

    SELECT TOP 1 cn2.[Change Notification Number], cn2.[Change Request Number]

    FROM Table1 cn2

    WHERE tb1.[Change Notification Number] = cn2.[Change Notification Number]

    ORDER BY cn2.[Change Notification Number], cn2.[Change Request Number]

    ) A

    ON a.[Change request Number] = tb1.[Change Notification Number]

  • You cannot reference tb1 in the derived table. So you should remove this line from the derived table:

    WHERE tb1.[Change Notification Number] = cn2.[Change Notification Number]

    If you explain what the query is supposed to do you might get another solution offered.

    Please see the links in my signature to see how to post to get better answers.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply