Results 1 to 2 of 2

Thread: Multiple Databases

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2006
    Posts
    266

    Question Multiple Databases

    Hi,

    Is it possible to access data from more than one database at a single time ? I mean with a single connection. Along with this I would like to know how to extract the common names available in 2 different tables in 2 different databases by using a single query. Please help.

    Thank you so much.

  2. #2
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Multiple Databases

    Prefix the table name with the schema name.

    Code:
    mysql> select t1.id, t2.id from test.table1 t1 left join test2.table1 t2 on (t1.id=t2.id);
    +----+------+
    | id | id   |
    +----+------+
    |  1 |    1 |
    |  2 |    2 |
    +----+------+
    2 rows in set (0.07 sec)
    the user account you use to connect will need appropriate permissions in both databases.

Posting Permissions

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



Click Here to Expand Forum to Full Width