To select the contents of both into one table, you most likely want to use
the 'UNION' operator:

SELECT * FROM desktops
UNION
SELECT * FROM laptops

If you create the computers table before hand (you can see how you would
create either of the others with SHOW CREATE tablename), then you can just
do one INSERT into the new table, using a select similar to the one above.


Thanks,

Matt


-----Original Message-----
From: Brad Tilley [mailto:[EMAIL PROTECTED] 
Sent: 03 April 2004 21:00
To: [EMAIL PROTECTED]
Subject: two tables with same field names into one table

Hello,

I am a mysql newbie. Recently, I've been given the task of joining two
tables 
within the same DB into one table. Currently, the tables are named
'desktops' 
and 'laptops'... ultimately, I would like one table named 'computers' Both 
tables have the exact same fields... they fields even have the same names. I

tried this:

create table computers 
select * from desktops, laptops where
desktops.field_1 = laptops.field_1
...
...
...

But I got an error about duplicate field names. Any suggestions on how to do

this?

Thanks,
Brad


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to