www.webdeveloper.com
Results 1 to 3 of 3

Thread: Select query from two databases

  1. #1
    Join Date
    Aug 2009
    Posts
    23

    Select query from two databases

    I can't figure this out.
    I have two tables in two different dbs, they are not alike at all but do have one column that is the same.

    Table A contains all users in the company.
    Table B contains users that have access to an application.

    I want to get the list of users from Table A that do not exist in Table B.

    Should I be using Union or Joins?
    Examples please.


    Thanks in advance.

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,145
    I'm thinking maybe a nested query?
    Code:
    SELECT * FROM database_1.table_a WHERE user NOT IN (
       SELECT user FROM database_2.table_b
    )
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  3. #3
    Join Date
    Aug 2009
    Posts
    23
    thanks nogdog, that did it.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles