Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL append from one table to another table
Message
From
15/08/2005 18:46:54
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01041168
Message ID:
01041171
Views:
23
>I have two identical tables and want to either merge them both into a new table, or append from one table to the other table. I have tried INSERT FROM TABLE, but can not get it to work. Also tried INSERT FROM ARRAY, but the two tables have their columns in slightly different order so copying to and from an array will not work.
>
>thanks
>
>Brenda
INSERT INTO anotherTable; && comment for a new table
SELECT FIELDLIST1 FROM TABLE1;
UNION ALL ; && remove ALL for distinct
SELECT FIELDLIST2 FROM TABLE2;
&& INTO TABLE NewTable  && uncomment for a new table
SELECT TABLE1
COPY TO NEWTABLE
SELECT 0
USE NEWTABLE
APPEND FROM TABLE2
INSERT INTO anotherTable;
SELECT FIELDLIST FROM oneTable
SELECT anotherTable
APPEND FROM oneTable
Previous
Reply
Map
View

Click here to load this message in the networking platform