newbie mySQL question
From: Westcoast Sheri (sheri_deb88_at_nospamun8nospam.com)
Date: 11/23/04
- Next message: M.E. Post: "Re: eMails durch PHP mit digitaler Signatur"
- Previous message: R. Rajesh Jeba Anbiah: "Re: PHP session on IIS"
- Next in thread: Pedro Graca: "Re: newbie mySQL question"
- Reply: Pedro Graca: "Re: newbie mySQL question"
- Reply: Andy Hassall: "Re: newbie mySQL question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 23 Nov 2004 19:13:33 GMT
I have 2 tables (table_one and table_two) that I want to combine into
one big table called "table_new."
Both tables consist of 2 columns: "fruit" and "quantity" (see my "create
table" samples below so you can understand my complex table structure
:-) Of course, table_one might have some fruits in it that table_two
doesn't have, and vice versa:
For example, here's what table_one has in it:
pomegranites 6
grapes 12
apples 9
here's what table_two has in it:
grapes 4
apples 2
bananas 5
rasberries 38
I want to combine them, so table_new ends up with:
pomegranites 6
grapes 16
apples 11
bananas 5
rasberries 38
So how can I make table_new without giving me an error on duplicate key
errors? what would be the mysql syntax to combine both tables into one
big table?
CREATE TABLE table_one (
fruit varchar(100),
quantity int(5),
PRIMARY KEY (fruit),
KEY quantity (quantity)
)
CREATE TABLE table_two (
fruit varchar(100),
quantity int(5),
PRIMARY KEY (fruit),
KEY quantity (quantity)
)
THANKS!!
- Next message: M.E. Post: "Re: eMails durch PHP mit digitaler Signatur"
- Previous message: R. Rajesh Jeba Anbiah: "Re: PHP session on IIS"
- Next in thread: Pedro Graca: "Re: newbie mySQL question"
- Reply: Pedro Graca: "Re: newbie mySQL question"
- Reply: Andy Hassall: "Re: newbie mySQL question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|