Solved

Demonstrate joining of two mysql databases

Posted on 2014-12-21
2
304 Views
Last Modified: 2015-01-05
I have mysql and want to write some syntax demonstrating the joining of two databases into a single table.  Assistance is greatly appreciated.
0
Comment
Question by:frugalmule
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 58

Accepted Solution

by:
Gary earned 500 total points
ID: 40512115
INSERT INTO db1.newtable 
SELECT * FROM db1.tablename
JOIN db2.tablename ON db1.id = db2.id

Open in new window


This assumes all column names follow the same order as the new table else you would have to specify them in the select statement.
0
 
LVL 58

Expert Comment

by:Gary
ID: 40512116
And rereading again maybe I'm misunderstanding
joining of two databases into a single table
What exactly do you mean?
Is this two tables with the same data but in two db's and you just want to move all the rows to one table?
0

Featured Post

Upcoming Webinar: Securing your MySQL/MariaDB data

Join Percona’s Chief Evangelist, Colin Charles as he presents Securing your MySQL®/MariaDB® data on Tuesday, July 11, 2017 at 7:00 am PDT / 10:00 am EDT (UTC-7).

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question