Mysql中select into from用法

原文:http://www.111cn.net/database/mysql/60705.htm

       

       把一个表中的数据转存带另一张表里

       方法一:在mysql中用select into from一直报错,

       错误:#1327 - Undeclared variable: target_test

       select into from要求目标表target_table不存在,因为在插入时会自动创建

       后来在网上看资料说Mysql不支持select into from语句,所以用其他方法来替代select into from语句:

       Create table target_table(Select * from Table1);

     

       方法二:INSERT INTO table_1 (SELECT * FROM table_2)

       把table_2数据转存到table_1,此方法适合table_1已经创建的。

posted @ 2015-09-18 18:06  阿特洛波斯的跳刀  阅读(14960)  评论(0编辑  收藏  举报