Mysql 把查询内容放入新表
create table newtable select * from basetable WHERE `type` ='test';
查询basetable中 type为test的条目存入新表newtable中.
新表会自动创建.
ps:
mysql 貌似不支持select into
其它有关复制查询结果到表的信息:
1 select into 和 insert into select 两种表复制语句
2 select * into destTbl from srcTbl
3
4 insert into destTbl(fld1, fld2) select fld1, 5 from srcTbl
5
6 以上两句都是将 srcTbl 的数据插入到 destTbl,但两句又有区别的。
7
8 第一句(select into from)要求目标表(destTbl)不存在,因为在插入时会自动创建。
9
10 第二句(insert into select from)要求目标表(destTbl)存在,由于目标表已经存在,所以我们除了插入源表(srcTbl)的字段外,还可以插入常量