From: Christian Mack Date: May 18 1999 2:53pm Subject: Re: query on tables in second database when connection was made for first database List-Archive: http://lists.mysql.com/mysql/3512 Message-Id: <37417F04.364A87AA@compal.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Scott Liu wrote: > > I have tried the method to query tables in other database (B) when a > connection is made for > a database (A) as suggested in the "Re: join across databases". It did > not give me any error > nor it gave me any meaningful result. Any thought? > > Databases: A and B. > Table in B: region_xref > > mysql> use A > mysql> select * from B.region_xref where B.region_xref.main_id=20483 > -> go > Empty set (0.00 sec) <==== Did not work > across database > > mysql> use B > > Database changed > mysql> select * from B.region_xref where B.region_xref.main_id=20483 > -> go <============= It works > from the same database > +---------+-----------+ > | main_id | region_id | > +---------+-----------+ > | 20483 | 3 | > | 20483 | 10 | > | 20483 | 1 | > | 20483 | 5 | > | 20483 | 7 | > | 20483 | 8 | > +---------+-----------+ > > The original email on the "Re: join across databases": > > > > "Subject: > > Re: join across databases? > > Date: > > Wed, 5 May 1999 21:45:14 -0700 > > From: > > Thimble Smith > > To: > > Daevid Vincent , mySQL database > > > > References: > > > > On Wed, May 05, 1999 at 09:36:25PM -0700, Daevid Vincent wrote: > > > Is it possible to join across databases? > > > > Yes, it is. You can find the information in the manual. In short, > > you prefix the table name with the database name: > > > > SELECT l, p FROM db1.tableA, db2.tableB WHERE db1.tableA.m > > > db2.tableB.q > > > > Tim" > > Thanks, > > Scott Liu Hi Scott Sorry, couldn't reproduce your problem :( Can you provide a full example? Tschau Christian