SQL help...

Discussion in 'OT Technology' started by rumperpumper, Dec 2, 2005.

  1. rumperpumper

    rumperpumper New Member

    Joined:
    Mar 12, 2002
    Messages:
    2,342
    Likes Received:
    0
    Location:
    Brisbane, QLD, Australia
    is it possible to have one SQL query feferring to 2 databases to check data has been between 2 different databases?

    Really need as much help on thsi as i can get.

    Thanks!
     
  2. Frequency

    Frequency New Member

    Joined:
    Dec 30, 2004
    Messages:
    7,504
    Likes Received:
    0
    Location:
    PA
    i want to say yes it is possible but not easily
    or
    it is possible but not in a direct manner
    **pulls out SQL book for a more definite answer**
     
  3. Frequency

    Frequency New Member

    Joined:
    Dec 30, 2004
    Messages:
    7,504
    Likes Received:
    0
    Location:
    PA
    ok going back on my previous answer and saying not possible with pure SQL, with a language such as asp or php i will say what you want to do is possible but thats a whole other ball game
     
  4. OT Addict

    OT Addict New Member

    Joined:
    Nov 16, 2005
    Messages:
    19,510
    Likes Received:
    0
    Location:
    Vegas
    Agreed. Could you not connect to one, store your string in a variable, connect to the other then parse what you need?
     
  5. CyberBullets

    CyberBullets I reach to the sky, and call out your name. If I c

    Joined:
    Nov 13, 2001
    Messages:
    11,865
    Likes Received:
    0
    Location:
    BC, Canada/Stockholm, Sweden
    that would probably be the best way. in that case you could nest them accordingly for searching/etc.
     
  6. Astro

    Astro Code Monkey

    Joined:
    Mar 18, 2000
    Messages:
    2,047
    Likes Received:
    0
    Location:
    Cleveland Ohio
    In MS SQL and Oracle, you can query like so: SELECT * FROM [database1].[table1], [database2].[table2] WHERE [database1].[table1].id = [database2].[table2].id

    Trick is I think both databases need to be on the same database server to work, or the database server would need to know how to get to both databases. In MySQL, I don't think you can do this trick in SQL. Maybe its changed with the newer versions of MySQL. Otherwise, you have to resort to querying the data individually from each database and then figure out how to combine the results.
     

Share This Page