#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2002
    Location
    new york
    Posts
    84
    Rep Power
    13

    Question Join across databases


    I'm working on a project using mSQL and PHP (yes, Msql)...
    The support for this database is not that great, and I love the devshed so...

    i wish to extract a large block of text, around 1100 characters, from a table in one database, that table consists of a field linked to another table in another database.

    my questions are:

    1) is it possible to query across dbs???
    2) is a better db design to put the table to be queried in the database that contains the linked table???

    thank you!

    =-=-=-=-=-=-=-=-=-
    justin_dago
  2. #2
  3. /(bb|[^b]{2})/

    Join Date
    Nov 2001
    Location
    Somewhere in the great unknown
    Posts
    5,163
    Rep Power
    793
    Assuming that they are under the same mysql connection then this is not a problem.
    i.e.
    Code:
    select a.column_a, b.column_b from database_one.table_name as a inner join
     database_two.table_name as b on a.some_column=b.some_column
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2002
    Location
    new york
    Posts
    84
    Rep Power
    13
    the database is

    MiniSQL (mSQL) not mySQL...

    it should be the same. right??

    i suspected the syntax would be similar to a regular join... just use the "dot" operator???

    i'll try it.. thanks Onslaught!!

    how about the second question? what's your take on that?


    justin_dago
    Last edited by justin_dago; August 31st, 2002 at 02:42 PM.
  6. #4
  7. /(bb|[^b]{2})/

    Join Date
    Nov 2001
    Location
    Somewhere in the great unknown
    Posts
    5,163
    Rep Power
    793
    Sorry, missed the missing y. In theory it should be the same though.

    In reality, the way most of RDBMS use the term databases are just a replacement for the term schema. Because all of the data is stored in the same location it is easily accessible across different "databases" as long as your have appropriate rights granted to access each area needed.

    I personally think you should leave them in the most reasonable design possible. If this means seperate databases/schemas then so be it. I do this quite often in both DB2 and MySQL.

IMN logo majestic logo threadwatch logo seochat tools logo