Joining MySQL tables from different schemas

Today I ran into a situation whereby a client needed to join 2 tables which happened to be in different schemas but on the same host. One of the schemas was not being replicated and this particular table was moved appropriately there. To join tables which reside in different schemas, it is very simple:

SELECT u1.*, u2.* FROM database1.users u1 LEFT JOIN database2.users u2 ON WHERE > 10 and < 100

No comments: