SEARCH YOUR SOLUTION HERE  

Merge Two MySql databases

,

I have two databases on my website lebphoto.com with the same tables. One with a 1665 members and the other with 33 members, I want to merge them together. is there a way other than typing each records by myself or ask the members to register again

Thank you

Posted On: Thursday 25th of October 2012 11:11:15 PM Total Views:  124
View Complete with Replies




Related Messages:

MySQL - Need SQL Code to merge multiple rows into one with one common factor   (73 Views)
Need code take data in table in multiple rows and merge into one. IE Acct Number Product Type Count 123 Tree 2 123 Flower 5 123 Planter 1 Want Results to look like this Acct Prod Type Count Prod Type Count Prod Type Count 123 Tree 2 Flower 5 Planter 1
How to merge two columns with duplicate names?   (83 Views)
I'm fairly new to the SQL environment and tend to run into some problems at time, that said I'm trying to create a new table which will merge all the information from a previous two tables into a new one. But I run into duplication errors syntax. Below is my query: mysql> create view GO_Pfam_merge as -> select * -> from GO_merge_flat, Pfam_merge_flat -> where -> GO_merge_flat.UID='Pfam_merge_flat.UID' and -> GO_merge_flat.Y='Pfam_merge_flat.Y'; ERROR 1060 (42S21): Duplicate column name 'UID'
Page 2 - Merging commands and trying to do a selective table merge   (93 Views)
well, that's too bad, because the example in the manual is pretty simple -- UPDATE items,month SET items.price=month.price WHERE items.id=month.id; let's see what this would look like for your tables... UPDATE creature_proto, whydb_world SET creature_proto.mindamage = whydb_world.mindamage WHERE ... and that's where it breaks down for me, because i don't understand how your tables are related
How can I merge a number or Rows from the same Table?   (82 Views)
HI Guys, I am setting up a daily report of Automatic updates on our client Database. The problem is that there are 5 separate updates, and 35 companies. The status of each update is queried with a variant of the query below, where #####=stock, contracts, categories, debtors, inventory. PHP Code: USE sitedb INSERTINTO update_log(project_pkey,project_dbname,Last_#####_Update,test_date,#####_Update_Status) SELECT project_pkey,project_dbname,last_#####,date(now()),if(date(last_#####)
Need help performing a database merge operation.   (74 Views)
I have two databases. One contains update information and the other is the production database. I've performed the merge to update the data in production from the feed database, but now I need to remove records from the production database that are no longer valid. The instructions are rather vague: the feed set is found with a join of feed.components with feed.component_files on component id the production set is found with a join on feed.components with production.component_files on component_id Then I'm supposed to delete, from production.component_files those records where a left join between the production set and the feed set have nulls for the feed set. Any ideas on how to form the SQL for this operation
Need help performing a database merge operation.   (69 Views)
I have two databases. One contains update information and the other is the production database. I've performed the merge to update the data in production from the feed database, but now I need to remove records from the production database that are no longer valid. The instructions are rather vague: the feed set is found with a join of feed.components with feed.component_files on component id the production set is found with a join on feed.components with production.component_files on component_id Then I'm supposed to delete, from production.component_files those records where a left join between the production set and the feed set have nulls for the feed set. Any ideas on how to form the SQL for this operation
Need Help on merge table!!!   (63 Views)
Dear Masters, I have a problem on comparing data. I have two databases that have a similar (if not same) tables, but holds different data, and I want to merge the two tables. But can't seem to figure the easy way to do that, again and again I use script (PHP) to do that, which is take a long time. The tables which I mentioned is like this, I have two databases, A and B, stored in different server, in each of the databases, I have table called t, so it will be like A.t and B.t. The t table holds schema like id, username, email, password. The thing is, each of the table, holds different data, yet many of them share the same data in terms of username or email. One of the table has more records than others, say, A.t has more records than B.t. Now, I would like to merge them into one table, with A.t to be the main reference (because it holds more records). So, any of record in B.t that has similarity with record in A.t will have to be thrown out, and any record that is different, will have to be putted in A.t. Are there any ways to do that within database level Any guidance is expected, please enlightened me
How to merge two or three different tables in one?   (296 Views)
, I have big problem, I dont know how to merge two or more tables (with it data) into one new. I need to transform my old mysql from my old site into new mysql structure for new site. What I want to do is to transform and copy only user details table from old to new. In old mysql user details are stored into 3 tables with some columns and in new table I have only one table with some columns. That 3 tables have same number of data rows and I array it by ID number. Because I dont need all columns from my user tables from old mysql, I will delete unnecessary columns and leave columns which I need for new table. Now question, how I to merge this three tables to I get only one with certain table structure Too, I need when merge to copy and all user data which are now stored into that 3 tables and that user data to be merged. Database is MyISAM, table 1, 2 and 3 had some same columns (ID of user and user status) but I delete it from table 2 and 3 because I need only one of it in new table. Can anyone help me please Thank you very much, Mladen
Mysql migration/merge help   (77 Views)
hello everybody. i have a live website and a test website located on a linux machine. I made a backup(DB) of the live site and need integrate that backup into the test database for testing. not sure weather its called merge or migration but i could use some help with the how to. i have mysql migration and navicat but not sure if this is the tool i should be using and not sure how to go about doing this. any ideas r
merge two SQL statement into one   (134 Views)
Hi I have this Store Procedure I need some help to make the Two SQL statements into one statement can anyone help Code: Create PROCEDURE GetReportByDynamicQuestion @DynamicQuestionID uniqueidentifier AS BEGIN Select Distinct Count (*) as [Total], Response, ((Count (*)*100)/(select COUNT(*) from DynamicRegistration_QuestionResponse where DynamicQuestionID = @DynamicQuestionID)) as [Percentage] From DynamicRegistration_QuestionResponse where DynamicQuestionID = @DynamicQuestionID group by Response select COUNT(*) as [Total Response], ((Count (*)*100)/(select COUNT(*) from DynamicRegistration_QuestionResponse where DynamicQuestionID = @DynamicQuestionID)) as [total Percentage] from DynamicRegistration_QuestionResponse where DynamicQuestionID = @DynamicQuestionID; END
merge these 3 queries into one?   (85 Views)
I have a function in my "products" class that creates objects for the three tables our towbar product rage is stored in (witter, westfalia and misc) I then have another function to merge all these data sets into one array. would there be a way to have mysql do that for me in one query below is my current code PHP Code: classsearchextendsutil { var$total=0; functiontotal() { $this->total=$this->witter->num_results+$this->westfalia->num_results+$this->misc_bars->num_results; } functionmerge() { $witter=array(); $westfalia=array(); $misc_bars=array(); $witter = $this -> witter -> make_array(); $westfalia = $this -> westfalia -> make_array(); $misc_bars = $this -> misc_bars -> make_array(); $r=array_merge(array($witter),array($westfalia),array($misc_bars)); foreach($ras$outer) { foreach($outeras$inner) { $return[]=$inner; } } return$return; } functiontowbars($db,$condition="") { //firstletsexecutesomequeries //witter $db->sql="SELECT code ASpart_number, manufacturer, smod ASmodel, Model ASdescription, retail ASprice, yearf ASyear_from, yeart ASyear_to, type, bypass, bumpercut, LOWER('witter')AStowbarmake FROMwitter$condition"; $this->witter=$db->q(); //westfalia $db->sql="SELECT code ASpart_number, manufacturer, smod ASmodel, Model ASdescription, rrp ASprice, yearf ASyear_from, yeart ASyear_to, type, bypass, bumpercut, LOWER('westfalia')AStowbarmake FROMwf$condition"; $this->westfalia=$db->q(); //misc_bars $db->sql="SELECT code ASpart_number, Manufacturer, smod ASmodel, Model ASdescription, rrp ASprice, yearf ASyear_from, yeart ASyear_to, type, bypass, bumpercut, towbarmake FROMmisc_bars$condition"; $this->misc_bars=$db->q(); $this->total(); return$thistotal; } } , instead of all of those converts, you could change the collations on the tables themselves...
Merging commands and trying to do a selective table merge   (80 Views)
Ok, the first problem is this. I have a large section of SQL commands to do, and I wish to know if there's a more efficient solution to do this. Background: I am working with multiple databases, each one is the same general format, but the data is dissimilar. It's incorrect in varying ways. The code below is intended to iron out some of those issues by pulling in fresh data from a second DB that is more accurate regarding aspect of the database as a whole. [MYSQL]DELETE FROM vendors WHERE entry=30239; INSERT INTO vendors SELECT * FROM ncdb_world.vendors WHERE entry=30239;[/MYSQL] The second issue is more complicated. I need a script that goes through the given table (in this case creature_proto) and selectively pulls in fresh data from another table when mindamage and maxdamage are both 1 or are both 0. The workaround I'm doing right now is manually looking at each entry in a table 36k entries long, and repeating the process every time there's a mass update. The code I'm using when I find a bad line is: [MYSQL]UPDATE creature_proto SET mindamage=11, maxdamage=14.19 WHERE entry=1721;[/MYSQL] Any assistance on these matters would be greatly appreciated. Thank you. - Aaron, Head Developer of MagicWoW Edit: Forgot to mention, I'm using MySQL 5.0.51b (comes standard with the version wampserver I'm using for MagicWoW)
Confused between join, merge, etc.   (66 Views)
Hi There - Have two tables, table A and table B, with identical schemas. I need to append the data from one onto the other. I'm migrating. I don't think join is the one - it's more side to side and I want something vertical. I've been researching merge and in some of the posts I've read, it sounds like it's temporary. I want this to be permanent. I've searched everywhich way I can think of to figure this out. I'd be grateful if someone can point me toward a manual page or give me the term I'm looking for so I can look it up.
Joining two tables with field names as column names   (77 Views)
I have two tables that are related to each other for a polling system im trying to write. One table has the options for the poll, and the other stores the results. What I'm trying to do is join those two tables together so that the output looks like a single table where the field values from the options table are the column names for the values from the results table. The options table looks like this: Code MySQL: id opt1 opt2 opt3 0 vote_1 vote_2 vote_3 and the results table looks like this: Code MySQL: poll_opt_id opt1 opt2 opt3 0 15 46 5 is it possible to join those two tables so that the output looks like this... Code MySQL: Options Results vote_1 15 vote_2 46 vote_3 5 I've been searching for hours and learining a whole lot of other stuff about mysql but nothing yet that will help me out with this.
SQL Select in two tables MySQL   (60 Views)
Hi all. I have two tables in mysql db: Code: TBL_1 | TBL_2 ------------------------------------ ID name | ID_1 name 1 jack | 1 jack 2 jane | 1 jack 3 paul | 2 jane 4 franck | 2 jane | 3 paul I need extract all rows of TBL_1 and the rows of TBL_2 if present in TBL_1. Can you help me kind regards viki
Delete from two tables   (112 Views)
So I've been trying to figure this one out this morning. I have two tables, work_history and work_history_detail. Not every work_history has a work_history_detail. I am trying to delete the records in work_history that fit a certain criteria and the corresponding records in work_history_detail (there is a request_id field in both tables). Any suggestions Should I delete from work_history and then go delete the records out of work_history_detail that don't have a record in work_history This is SQL Server.
Getting data from two tables in one column   (215 Views)
, I have a slightly tricky query that is giving me some trouble. I have 3 tables, as follows: keywords: id, name glossary: id, term, definition synonyms: id, synonym, glossary_id synonyms contains synonyms of the terms in my glossary. Keywords contains a list of keywords that we use throughout the site. What I need is to have a list of my keywords, and then have a list of any synonyms and glossary terms that match or are related to those keywords. So, basically, if keywords had 'cap', and glossary had 'hat' with a synonym of 'cap', my list needs to contain both 'cap' and 'hat'. Or, if my keywords and glossary had 'cap', and I had a synonym of 'hat', I still need both 'cap' and 'hat'.
Huge Performance difference in two forms of writing a subquery   (127 Views)
I wrote the following subquery to return the names of people that have a phone number in common with someone else: Code: SELECT Name FROM People WHERE Phone IN (SELECT Phone FROM People GROUP BY Phone HAVING COUNT(*) > 1) The table has about 100K rows and this takes about 20 seconds which does not make sense because running the subquery by itself takes only about 0.20 secs and the main query about that much if I enter the result of the subquesry manually (10 rows returned). So I would have expected this to run in 0.40 seconds and not 20! So MySQL must be doing something wrong here, interpreting this the wrong way or something or somehow running the subquery multiple times Though I can't see why. Playing around with this a little I then (almost accidentally) found that if I rewrite the above as: Code: SELECT Name FROM People WHERE Phone IN (SELECT Phone FROM (SELECT Phone FROM People GROUP BY Phone HAVING COUNT(*) > 1) InnerTable) Does indeed run in only 0.40 secs!!! Now I can't figure out why these two forms should behave so differently. I can't understand why MySQL would interpret the first one in any other way than the obvious and even more puzzling (to me) that the second form fixes the problem. I am happy to use the second form but I would also like to understand why this difference. The only other problem is that the second (and faster) form is not allowed to be written as a View, it complains that the View's SELECT contains a subquery in the FROM clause. Here are the explain plans for the two queries (I left out the columns that were NULL for all rows): First Form (SLOW): Code: +----+--------------------+--------+------+--------+----------------------------------------------+ | id | select_type | table | type | rows | Extra | +----+--------------------+------- +------+--------+----------------------------------------------+ | 1 | PRIMARY | People | ALL | 108423 | Using where | | 2 | DEPENDENT SUBQUERY | People | ALL | 108423 | Using where; Using temporary; Using filesort | +----+--------------------+--------+------+--------+----------------------------------------------+ Second Form (FAST): Code: +----+--------------------+------------+------+--------+----------------------------------------------+ | id | select_type | table | type | rows | Extra | +----+--------------------+------------+------+--------+----------------------------------------------+ | 1 | PRIMARY | People | ALL | 108431 | Using where | | 2 | DEPENDENT SUBQUERY | | ALL | 3 | Using where | | 3 | DERIVED | People | ALL | 108431 | Using where; Using temporary; Using filesort | +----+--------------------+------------+------+--------+----------------------------------------------+ Note that there is also a time difference to come up with each plan, the first one (SLOW) takes no time (0.00 sec) while the second one takes 0.20 sec, not sure if this matters or is in any way significant. Also welcome are any suggestions for a better way to write this query.
Problem JOINing two tables   (125 Views)
I have two tables, for simplicity lets call them Table AAA and Table BBB, I have a query as follows SELECT count(DISTINCT AAA.ID ) AS post_count, count( DISTINCT BBB.ID ) AS vote_count FROM AAA JOIN BBB ON BBB.user_id = 'John' WHERE AAA.user_id = 'john' Now this query works fine if both the tables contain records with user_id as 'John'. The problem arises when there's no 'John' in any of these two tables. There could be situation in my program where john has a entry in only table AAA or only BBB. In case he has no entries in the any table that corresponding DISTINCT COUNT should be returned as zero.
From one row to two rows ?   (96 Views)
Im making a simple document management system (php, mysql) for mainly paper documents and a few electronic ones. Table structure: Code: documents: id(int),fam(varchar(4), number(int), title(varchar) doc_rel : s_id(int), d_id(int), comment(varchar) The fam field indicates a family of documents, like modification (mod), non conformity (noc) etc. The number is a sequential number in that specific family. Both tables do have some more fields, like for dates. The relations are in the doc-rel table. When I make a new relation link for a document with ex. id=4, then this id goes to s_id and the linked document id goes to d-id. So the same document id can be found in s_id and in d_id, for links from it and links to it. To read it, I now use multiple queries. They first looks for a specific number in s_id and then another, almost similar looks to the d_id I like to use one single query where I can get all I need in one time. The output should be sorted on fam and number. Who does have a good suggestion wimb