Web Design, 3d & More - Aaron Newton 

nickelwound.com - MySQL: Join Tables from Different Databases

If you should need to access tables from multiple databases, or even JOIN tables from multiple databases, you can (provided the user you're connecting with has sufficient privileges):

SELECT
    c.customer_name,
    o.order_date
FROM
    db1.tbl_customers c LEFT JOIN
    db2.tbl_orders o ON o.customer_id = c.id

I needed to inner joing two geo-data tables across a MySQL database using only a single connection.

I should add that both users need the same permissions for this to work.

Posted by Aaron Newton 

Comments (0)

Leave a comment...



Contact Us   |