473,396 Members | 2,010 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to Copy Table1 to Table2 ?

I have 2 tables in a database:

As an example, let's say Table1 has 20 rows, like this:

Table1:
CategoryNumber CategoryName
1000 Radios
1001 CD Players
.... ...
1019 Older Electronics

Let's say Table 2 has 12 rows, like this
Table2:
Column1 Column2 ProductCategory
0000001 Dan Old TVs
0000002 Steve Old Computers
.... ...
0000011 Debbie Old Guitars

How do I copy all rows of Table1 to Table2 in as few MySQL statements as
possible ?
In otherwords, without writing 20 separate SQL Insert statements ?

Also, the columns from Table1 go into Table2 as described below:
Table1.CategoryNumber ---> Table2.Column1
"Owners Unknown" ---> Table2.Column2
Table1.CategoryName ---> Table2.ProductCategory

Many thanks for your help and patience regarding this newbie question.
Sincerely,
jc

Jul 19 '05 #1
0 1216

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: JC-Atl | last post by:
I have 2 tables in a database: As an example, let's say Table1 has 20 rows, like this: Table1: CategoryNumber CategoryName 1000 Radios 1001 CD...
2
by: ja | last post by:
hi, How copy two table between two database? copy 1 table1 to 2 table2 1 - cursor number, 2 - cursor number, table1 - sourse table table2 - destination table
5
by: Peter CCH | last post by:
Let's say, I have Table1 and Table2, both with the exactly same structure and data in it, except that Table1.Field1 is empty in data but Table2.Field1 have data in it. How could I copy all the...
4
by: Dejan | last post by:
Hy Sorry for my terreble english. I have mysql table1 on my local comp. It looks something like this. ---------------------------------------------------------------------------- -...
4
by: GTi | last post by:
I have two identical tables with one IDENTITY column and several other columns. I have tested the COPY * INTO table2 FROM table1 WHERE xx but it requers that table2 does not exist. TABLE2 is a...
0
by: Hetal | last post by:
Hi.. I am working on VB.NET 2003 (windows form) application and using ADO.NET to deal with databases. The table structure i am working with is as follows. DB1.Table1 (source)...
10
by: pbd22 | last post by:
Hi. Like the title says - how do i do this? I was given the following example: INSERT INTO TABLE2 SELECT * FROM TABLE1 WHERE COL1 = 'A' The above statement threw the following error:
14
by: Yas | last post by:
Hello, I have 2 tables, Table1 and Table2. I have copied all data from Table1 to Table2. However Table1 is dynamic it has new rows added and some old rows modified everyday or every other...
2
by: suren1503 | last post by:
Hi All Techies, I have created one DTS to copy table1 (which is on Oracle server) to table2 (on SQL Server 2000) I want to copy only new records + modified records from table1 to table2. I...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.