|
|
|
|
![]() ![]() |
Oct 13 2006, 08:17 AM
Post
#1
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 357 Joined: 8-April 06 Member No.: 21,487 |
Hi Dears
i have one question about mysql and table how can merge 2 table in mysql for example i have 2 table with this fields table 1 : QUOTE CREATE TABLE cd1 ( id tinyint(4) NOT NULL auto_increment, cat text NOT NULL, text text NOT NULL, image text NOT NULL, cd text NOT NULL, price text NOT NULL, space text NOT NULL, company text NOT NULL, name text NOT NULL, rate int NOT NULL, PRIMARY KEY (id) ) TYPE=MyISAM; Tabel 2 : QUOTE CREATE TABLE cd2 ( id tinyint(4) NOT NULL auto_increment, cat text NOT NULL, text text NOT NULL, image text NOT NULL, cd text NOT NULL, price text NOT NULL, space text NOT NULL, company text NOT NULL, name text NOT NULL, rate int NOT NULL, PRIMARY KEY (id) ) TYPE=MyISAM; In table 2 i have many (1200) records and row but in table 1 i have 200 row i want bind this 2 table and make one tabel with (1400) row , how can do this ? with command ? with script or with phpmyadmin ? thanks all |
|
|
|
Oct 13 2006, 02:20 PM
Post
#2
|
|
|
A computer once beat me at chess, but it was no match for me at kick boxing. ![]() Group: [MODERATOR] Posts: 4,301 Joined: 24-July 05 From: Linix, DOS and Windows…the good, the bad and the ugly Member No.: 9,787 ![]() myCENT:63.90 |
Try phpadmin.
I am sure you can have it perform a backup of the smaller table with the structure included. This will create a text file containing all the SQL neccessary to Create the table and also provides the neccessary INSERT commands. Then Modify the text file which it has created to : 1) remove the CREATE TABLE command and 2) Edit to remove the id's from the records, since this may cause some problems if you have duplicate id's. Use find / replace? 3) Use find/replace as required to point to the larger of the Tables and issue the INSERT commands against the second table instead of the first. Voila! The updated table should contain both sets of data. You might then DROP the smaller table or keep it as a backup, but check to make sure the transfer was successful, first |
|
|
|
Oct 13 2006, 02:38 PM
Post
#3
|
|
|
Look around, what do you see? Incorrect. ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 1,118 Joined: 12-April 06 From: Essex, UK Member No.: 21,719 myCENT:47.88 |
similar to what is already said i belive you can export data from phpmyadmin and then import it from a text file. Has the same effect as already posted but much easier to do.
hope that helps a bit as well. |
|
|
|
Oct 16 2006, 04:54 PM
Post
#4
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 357 Joined: 8-April 06 Member No.: 21,487 |
Hi Dear shadowx
Yes i use phpmyadmin , but i get export form database and i want import in to large database , but in phpmyadmin export page . we have 3 options (instert , update , Replace ) i Read your note (i know i must use insert ) but if you have more info about this 3 Options please post here Really thanks , your post is very nice |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 22nd November 2008 - 11:04 PM |