要把下面select出来的数据插入一个新表 用什么sql语句阿
select c.factno
a.idno
a.emplno_new
a.emplnm
a.enterdt
a.eaddr
c.deptno
c.deptnm
b.kindid
a.ins_user
a.ins_date
FROM hrs100t0 a, hrs110t0 b, hrs006t0 c
where a.idno = b.idno
and b.deptid = c.deptid
and b.gradseq = 1 --当前部门职位信息
and b.stop_date is null --在职人员
这个是新表
create table HRS100T0_TEST
(
FACTNO VARCHAR2(4) not null,
IDNO VARCHAR2(20) not null,
EMPLNO_NEW VARCHAR2(8),
EMPLNM VARCHAR2(30),
ENTERDT VARCHAR2(8),
EADDR VARCHAR2(60),
DEPTNO VARCHAR2(8),
DEPTNM VARCHAR2(30),
KINDID VARCHAR2(1) not null,
INS_USER VARCHAR2(20),
INSDATE DATE,
MEMO VARCHAR2(2000)
)
问题会不会太弱智了点-。-
select c.factno
a.idno
a.emplno_new
a.emplnm
a.enterdt
a.eaddr
c.deptno
c.deptnm
b.kindid
a.ins_user
a.ins_date
FROM hrs100t0 a, hrs110t0 b, hrs006t0 c
where a.idno = b.idno
and b.deptid = c.deptid
and b.gradseq = 1 --当前部门职位信息
and b.stop_date is null --在职人员
这个是新表
create table HRS100T0_TEST
(
FACTNO VARCHAR2(4) not null,
IDNO VARCHAR2(20) not null,
EMPLNO_NEW VARCHAR2(8),
EMPLNM VARCHAR2(30),
ENTERDT VARCHAR2(8),
EADDR VARCHAR2(60),
DEPTNO VARCHAR2(8),
DEPTNM VARCHAR2(30),
KINDID VARCHAR2(1) not null,
INS_USER VARCHAR2(20),
INSDATE DATE,
MEMO VARCHAR2(2000)
)
问题会不会太弱智了点-。-
idno
,emplno_new
, emplnm
,enterdt
,eaddr
,deptno
, deptnm
,kindid
, ins_user
, insdate
)
select c.factno
,a.idno
, a.emplno_new
,a.emplnm
,a.enterdt
,a.eaddr
, c.deptno
, c.deptnm
, b.kindid
, a.ins_user
, a.ins_date
FROM hrs100t0 a, hrs110t0 b, hrs006t0 c
where a.idno = b.idno
and b.deptid = c.deptid
and b.gradseq = 1 --当前部门职位信息
and b.stop_date is null --在职人员
insert into HRS100T0_TEST(
idno ,emplno_new , emplnm ,enterdt ,eaddr ,deptno
, deptnm ,kindid , ins_user , insdate
)
select c.factno ,a.idno , a.emplno_new ,a.emplnm ,a.enterdt ,a.eaddr , c.deptno
, c.deptnm , b.kindid , a.ins_user , a.ins_date
FROM hrs100t0 a, hrs110t0 b, hrs006t0 c
where a.idno = b.idno
and b.deptid = c.deptid
and b.gradseq = 1 --当前部门职位信息
and b.stop_date is null --在职人员
create table b as select * from a,如果只要表结构,不要数据,就加上where0=1