標題:
關於 MYSQL COPY TABLE Command
發問:
關於 MYSQL COPY TABLE Command 怎樣把 MYSQL 資料庫ABC的 TABLE:ONE, TABLE:TWO, TABLE:THREE, COPY TO 資料庫ABC的 TABLE:TOTAL. thank a lot easy9756 更新: e.g. TABLE ONE COST CENTER C1 TABLE TWO COST CENTER C2 TABLE THREE COST CENTER C3 更新 2: e.g. TABLE ONE STRUCTURE COST CENTRE,ID,NAME. TABLE ONE RECORD C1, C1001, AAA C1, C1002, BBB TABLE TWO STRUCTURE COST CENTRE,ID,NAME. TABLE TWO RECORD C2, C2001, CCC C2, C2002, DDD TABLE THREE STRUCTURE COST CENTRE,ID,NAME. TABLE THREE RECORD C3, C3001, EEE C3, C3002, FFF
最佳解答:
if "TOTAL" is a existing table and u want to insert all records from tables "ONE", "TWO", "THREE". ?u can use following SQL. INSERT into total (?cost_centre, id, name ) SELECT cost_centre, id, name FROM one? UNION ALL SELECT cost_centre, id, name FROM two? UNION ALL? SELECT cost_centre, id, name FROM three. If "TOTAL" isn't a existing table and u need to create it and?to insert all records from tables "ONE", "TWO", "THREE". ?u can use following SQL. CREATE TABLE total AS SELECT cost_centre, id, name FROM one? UNION ALL SELECT cost_centre, id, name FROM two UNION ALL? SELECT cost_centre, id, name FROM three.
關於 MYSQL COPY TABLE Command
發問:
關於 MYSQL COPY TABLE Command 怎樣把 MYSQL 資料庫ABC的 TABLE:ONE, TABLE:TWO, TABLE:THREE, COPY TO 資料庫ABC的 TABLE:TOTAL. thank a lot easy9756 更新: e.g. TABLE ONE COST CENTER C1 TABLE TWO COST CENTER C2 TABLE THREE COST CENTER C3 更新 2: e.g. TABLE ONE STRUCTURE COST CENTRE,ID,NAME. TABLE ONE RECORD C1, C1001, AAA C1, C1002, BBB TABLE TWO STRUCTURE COST CENTRE,ID,NAME. TABLE TWO RECORD C2, C2001, CCC C2, C2002, DDD TABLE THREE STRUCTURE COST CENTRE,ID,NAME. TABLE THREE RECORD C3, C3001, EEE C3, C3002, FFF
最佳解答:
if "TOTAL" is a existing table and u want to insert all records from tables "ONE", "TWO", "THREE". ?u can use following SQL. INSERT into total (?cost_centre, id, name ) SELECT cost_centre, id, name FROM one? UNION ALL SELECT cost_centre, id, name FROM two? UNION ALL? SELECT cost_centre, id, name FROM three. If "TOTAL" isn't a existing table and u need to create it and?to insert all records from tables "ONE", "TWO", "THREE". ?u can use following SQL. CREATE TABLE total AS SELECT cost_centre, id, name FROM one? UNION ALL SELECT cost_centre, id, name FROM two UNION ALL? SELECT cost_centre, id, name FROM three.
此文章來自奇摩知識+如有不便請留言告知
其他解答:文章標籤
全站熱搜
留言列表