Of course, the select list has to match the fields in the insert table. But, you can specify the fields in both the insert side and the select side.
How do I force the insert order ? cause insert into mytable select * from oldtable order by old_table_key1 doesn't seem to work.
Your Help would be appreciated
No. VFP8 does not let you do it with order By in the 2nd select. But why would you need it? The important thing may be to select a subset from the 2nd table, not select all by some order, as the index on the 1st table (recipient table) would take care of that.
Example:
Close Tables all
Set Talk off
Set safety off
USE Home(2)+"\northwind\customers"
Copy To Sys(2023)+"\junk.dbf" next 1
Select 0
USE Sys(2023)+"\junk.dbf"
replace customerid with "ZZZZ"
INSERT INTO customers (customerid,city) SELECT customerid,city FROM junk where customerid = "ZZZZ"
Select customers
Go BOTTOM
Browse Last Nocaptions
Close TABLES ALL
Erase Sys(2023)+"\junk.dbf"