Site Fuse! programming, design, hosting, promotion and advertising tips for webmasters
Design    Programming    Hosting    Classifieds

Create new table using two existing tables


Important: The following is a text only archive!
For full features; Go to Create new table using two existing tables

posted by 2Guns Call me dumb but I found this while I was trying to find a way to create a new table by combining two tables that exists in my database...

Basically what you gotta do is to join two tables just like you join them with select command...

CREATE TABLE new_table_name
SELECT *
FROM table1 t1, table2 t2, WHERE t1.id = t2.id;

you can also specify which columns you want in your new table;

CREATE TABLE new_table_name
SELECT t1.title, t1.address, t2.name, t2.age
FROM table1 t1, table2 t2, WHERE t1.id = t2.id;