Please help with query

  • This code generates my date with no problems:

    select *

    FROM

    S_ADDR_PER a,ContactDataMaskTemp b, S_CONTACT c

    where a.ROW_ID = c.PR_PER_ADDR_ID

    and c.PER_TITLE_SUFFIX = b.CIFNUMBER collate Latin1_General_CI_AS

    This code on the other hand gives me the following error: The multi-part identifier "c.PR_PER_ADDR_ID" could not be bound.

    select *

    FROM

    S_ADDR_PER a

    INNER JOIN ContactDataMaskTemp b

    ON a.ROW_ID = c.PR_PER_ADDR_ID

    INNER JOIN S_CONTACT c

    ON c.PER_TITLE_SUFFIX = b.CIFNUMBER collate Latin1_General_CI_AS

    I dont understand why as arent these two queries exactly the same?

    I must be missing something obvious.

    Any help?

  • Nevermind. Im being a moron!:blush:

  • Yeah you are missing something obvious. You are joining on c.PR_PER_ADDR_ID and I think you want b.PR_PER_ADDR_ID. Check out the bolded code, I also italicized the aliases in question:

    select

    *

    FROM

    S_ADDR_PER a INNER JOIN

    ContactDataMaskTemp b ON

    a.ROW_ID = c.PR_PER_ADDR_ID NNER JOIN

    S_CONTACT c ON

    c.PER_TITLE_SUFFIX = b.CIFNUMBER collate Latin1_General_CI_AS

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

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