sql 如何把查询得到的结果如何放入一个新表中

时间:2023-03-09 19:46:19
sql 如何把查询得到的结果如何放入一个新表中

sql 如何把查询得到的结果如何放入一个新表中

如何把这个查询到的结果放到一张新表中?

2014-03-13 15:26

提问者采纳

表已经存在;
insert into 表名 (列名1.。。 列名n) select 列名1.。。。列名n from 表 where 条件
表不存在.
oracle
create table 新表明 as select 列名1.。。。列名n from 表 where 条件
sqlserver
select 列名1.。。。列名n
into 新表名
from 表 where 条件
追问:
没有原表,我通过
select collection_date,pub_date,count(*) as 'sum' from r_time
group by pub_date,collection_date
这个语句得到的新表,具体怎么才能放到一张新表中,能不能写详细点?
追答:
oracle
crate table 新表名
select collection_date,pub_date,count(*) as 'sum' from r_time
group by pub_date,collection_date
sqlserver
select collection_date,pub_date,count(*) as 'sum'
into 新表名
from r_time
group by pub_date,collection_date
提问者评价
谢谢!