Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2004
    Posts
    29

    Unanswered: Access tables from different DBs

    On one server (ds_1), I have two databases (db_1, db_2).
    How can I access tables from each database during one session?
    db_1 has the id table with field emp_id.
    db_2 has the salary table with field emp_id, bonus.

    I want to do:

    SELECT a.emp_id, b.bonus
    FROM db_1.id a, db_2.salary b
    WHERE a.emp_id = b.emp_id

  2. #2
    Join Date
    May 2004
    Posts
    21
    Quote Originally Posted by Jim Richards
    On one server (ds_1), I have two databases (db_1, db_2).
    How can I access tables from each database during one session?
    db_1 has the id table with field emp_id.
    db_2 has the salary table with field emp_id, bonus.

    I want to do:

    SELECT a.emp_id, b.bonus
    FROM db_1.id a, db_2.salary b
    WHERE a.emp_id = b.emp_id
    it should be database.owner.table -> database..table
    SELECT a.emp_id, b.bonus
    FROM db_1..id a, db_2..salary b
    WHERE a.emp_id = b.emp_id

Posting Permissions

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