Cross DB join

  • I have a query that runs fine, but I need to get the matching loan number from another DB.

    select

    zone,

    data_date,

    loan,

    altloannumber,

    oldloannumber

    from loandata

    where data_date > '2009-11-06'

    order by loan

    I need to get the matching loan # (called borrowerid) from a different DB on the same server called LPB_ReportingServices. Not sure of the syntax..

  • krypto69 (11/6/2009)


    select

    zone,

    data_date,

    loan,

    altloannumber,

    oldloannumber

    from loandata

    where data_date > '2009-11-06'

    order by loan

    I need to get the matching loan # (called borrowerid) from a different DB on the same server called LPB_ReportingServices. Not sure of the syntax..

    select

    zone,

    data_date,

    loan,

    altloannumber,

    oldloannumber

    from loandata T1

    JOIN <OTHERDB>.<schema>.<TableName> T2

    ON T1.BorrowerID = T2.BorrowerID

    where T1.data_date = '2009-11-06'

    order by loan

    Does this help?

    ---------------------------------------------------------------------------------

  • Thank man...

    It's saying invalid column name borrowerid

  • then that column is not there in either of the table .. identify the columns you want to join the tables on first!

    ---------------------------------------------------------------------------------

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

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