farsiscript 0 Report post Posted October 13, 2006 Hi Dearsi have one question about mysql and table how can merge 2 table in mysql for example i have 2 table with this fieldstable 1 : 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 : 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 rowi 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 Share this post Link to post Share on other sites
jlhaslip 4 Report post Posted October 13, 2006 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 Share this post Link to post Share on other sites
shadowx 0 Report post Posted October 13, 2006 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. Share this post Link to post Share on other sites
farsiscript 0 Report post Posted October 16, 2006 Hi Dear shadowxYes 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 hereReally thanks , your post is very nice Share this post Link to post Share on other sites