On Thu, Nov 06, 2003 at 10:36:08AM -0800, Jay Frumkin wrote:
> Hello all,
>  
> I am fairly new to MySQL.  I have a problem, that I have not been able to
> figure out.  I've tried searching the net and reading the manual, but all to
> no avail.
>  
> I have two databases (A and B) which have the same structure but different
> field names.  The code from mysqldump follows (comments removed for
> brevity):
>  
> CREATE TABLE a (<?xml:namespace prefix = o ns =
> "urn:schemas-microsoft-com:office:office" />

There's no way that mysqldump generated that line.

[snip]

> What I want to do, is create a select statement which pulls info from both
> databases and displays it sorted by date.

You can simply fully qualify the db/table names using dot notation:

  dbname.tablename.fieldname

in your queries.  Or just the table names if the fields are already
different.

SELECT test1, test2 FROM db1.foo, db2.bar
WHERE db1.foo.test1 = db2.bar.test2
...

Jeremy
-- 
Jeremy D. Zawodny     |  Perl, Web, MySQL, Linux Magazine, Yahoo!
<[EMAIL PROTECTED]>  |  http://jeremy.zawodny.com/

MySQL 4.0.15-Yahoo-SMP: up 53 days, processed 2,006,167,978 queries (431/sec. avg)

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to