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
oracle crate table 新表名 select collection_date,pub_date,count(*) as 'sum' from r_time group by pub_date,collection_date .
举例:
1、select a.stk_c,b.name,cat_c3 from (select stk_c from stk_dtl where stk_qty>0 group by stk_c) a,stk_mas b where a.stk_c=b.stk_c
2、select * from (SELECT SUM(NUM_QNTY4) AS sumNum, NUM_LINKID FROM RW_STORE_QUNTY GROUP BY NUM_LINKID ) a left join b on a.NUM_LINKID =b.NUM_LINKID
where a.NUM_LINKID = 1002
3、select a.realname,b.username from sa_member a,(select username2 as username,is_agree from sa_MemberFriend where username1='jhgjhg' union all select username1 as username,is_agree from
table1是要查询的表
table2是新表
2014-03-13