Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2004

    Question Unanswered: Help with linked server query...


    I have the following query:

    select col1, col2, col3 from [linked_server].db1.dbo.tbl1
    where col1 not in (select col1 from tbl1)

    I get the columns that I need from the linked server, but I am not sure how to add to the results col1 from the local sql server?

    so the results I would get would be:

    linked.col1, linked.col2, linked.col3, local.col1

    Any help would be greatly appreciated!


  2. #2
    Join Date
    Feb 2004
    In front of the computer
    Provided Answers: 54
    Bearing in mind that I'm almost certain what you asked for is not what you really want, the solution would be:
    SELECT r937.col1, r937.col2, r937.col3, PatP.col1
       FROM [linked_server].db1.dbo.tbl1 AS r937
       LEFT OUTER JOIN tbl1 AS PatP
          ON (PatP.col1 = r937.col1)
       WHERE  PatP.col1 != r937.col1

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts