Merging databases!?

This is a discussion on "Merging databases!?" within the Databases section. This forum, and the thread "Merging databases!? are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > Databases

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Oct 2nd, 2007, 13:02
Reputable Member
Join Date: Sep 2007
Location: Tehran - Iran
Age: 29
Posts: 434
Blog Entries: 2
Thanks: 7
Thanked 7 Times in 7 Posts
Exclamation Merging databases!?

I have created a new database for a website, and now I get the old database from the client and they want to merge it with new one.
The problem is the old one has different names and tables. But they need it to be merged as soon as possible,
What can I do ?
This is very urgent ...
__________________
Designing For Communicating
Website : http://www.datisdesign.com
Weblog : http://blog.datisdesign.com

Last Blog Entry: Throughout IRAN (Dec 10th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Oct 2nd, 2007, 13:19
Elite Veteran
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Urgent !

Please choose a better topic next time!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Oct 2nd, 2007, 13:42
Highly Reputable Member
Join Date: Apr 2007
Location: Willich, Germany
Age: 20
Posts: 593
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Merging databases!?

What kind of databases are we talkin' about? SQL? mySQL? Access?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Oct 2nd, 2007, 13:45
Reputable Member
Join Date: Sep 2007
Location: Tehran - Iran
Age: 29
Posts: 434
Blog Entries: 2
Thanks: 7
Thanked 7 Times in 7 Posts
Re: Merging databases!?

both are mysql but they are different in structures.
the old one has a table of users with many fields but new one has some of them
so i need to merge the old one with new one
__________________
Designing For Communicating
Website : http://www.datisdesign.com
Weblog : http://blog.datisdesign.com

Last Blog Entry: Throughout IRAN (Dec 10th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Oct 2nd, 2007, 13:52
Highly Reputable Member
Join Date: Apr 2007
Location: Willich, Germany
Age: 20
Posts: 593
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Merging databases!?

I would just SELECT everything from both old tables and write the result into a new table with the correct format. Any fields in the new table that don't exist in the old ones would just be filled with a default value.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Oct 2nd, 2007, 13:58
Reputable Member
Join Date: Sep 2007
Location: Tehran - Iran
Age: 29
Posts: 434
Blog Entries: 2
Thanks: 7
Thanked 7 Times in 7 Posts
Re: Merging databases!?

can u please give me the query command, coz i'm not very professional in mysql
__________________
Designing For Communicating
Website : http://www.datisdesign.com
Weblog : http://blog.datisdesign.com

Last Blog Entry: Throughout IRAN (Dec 10th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old Oct 2nd, 2007, 14:25
Highly Reputable Member
Join Date: Apr 2007
Location: Willich, Germany
Age: 20
Posts: 593
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Merging databases!?

Here's some (untested) code for starters. See if you can get it to work for you:
PHP: Select all

$query=mysql_query("SELECT * FROM old_table_name");
while(
$row=mysql_fetch_object($query)) {
  
mysql_query("INSERT INTO new_table_name (field1,field2) VALUES ('".$row->old_value1."','".$row->old_value2."')");

You'll have to adjust the table and field names, but if you run that over both of your old tables you should be able to write them into the new one.

(Remember to make some backups!!!)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Databases? Apocalyptic Poet Classic ASP 1 Apr 23rd, 2008 12:24
[SOLVED] Concerning speed: SSI, PHP, or pre-upload merging? MikeHopley Web Page Design 14 Oct 23rd, 2007 17:00
Local Business Listing Merging Morledge Search Engine Optimization (SEO) 2 Oct 20th, 2007 12:25
Merging images... maybe da_stimulator Web Page Design 1 Jan 22nd, 2005 01:32
Access databases.... anyone know much? benbacardi Databases 8 Jul 2nd, 2004 18:14


All times are GMT. The time now is 10:59.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42