Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Merge 2 Table In Mysql, Question
farsiscript
post 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 smile.gif
Go to the top of the page
 
+Quote Post
jlhaslip
post 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 Icon

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
Spam Patrol
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
Go to the top of the page
 
+Quote Post
shadowx
post 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.
Go to the top of the page
 
+Quote Post
farsiscript
post 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
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Mysql Downtimes...(39)
  2. Mysql Database Setup : Setting Up Mysql Database(6)
  3. Complete Login System(57)
  4. Increment A Mysql Column(7)
  5. Import From Excel File Into Mysql Database(11)
  6. Linking To Mysql From Vb(7)
  7. Mysql Database Size(7)
  8. Help Moving Mysql Files To A New Host(2)
  9. Can You Add Images Into A Mysql Database?(21)
  10. Ie Table Width In A Div Tag(5)
  11. Subquery In Mysql(5)
  12. Quick Question(10)
  13. Mysql Won't Update(5)
  14. It Went Well For A While(5)
  15. Mysql Db Is Down Getting Following Error(2)
  1. Need Advice On Setting Up Mysql Database.(4)
  2. The Only Reason I Choose Ms Sql Server Rather Than Mysql(0)
  3. Mysql Database Not Working(3)
  4. Creating A Php Login System Using Mysql(10)
  5. Mysql Hacks(6)
  6. Firefox And Ie: Table Layouts Look Different In Us!(5)
  7. Vb And Mysql(3)
  8. Mysql Server Down(10)
  9. Mccodes With Mysql! [resolved](6)
  10. Website Structure(3)
  11. Php Myadmin(6)
  12. How To Connect Mysql With Jsp ?(4)
  13. Beginning Php And Mysql: From Novice To Professional, Third Edition Review(1)


 



- Lo-Fi Version Time is now: 22nd November 2008 - 11:04 PM