要把下面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)
)
問題會不會太弱智了點-。-
uj5u.com熱心網友回復:
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 --在職人員
uj5u.com熱心網友回復:
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 --在職人員
uj5u.com熱心網友回復:
樓上兩個的都行,除此之外在建表時就能將其他表中的資料復制過來。例如:create table B as select * from A 。uj5u.com熱心網友回復:
uj5u.com熱心網友回復:
如果a表跟b表的表結構一樣,為何不直接create table b as select * from a,如果只要表結構,不要資料,就加上where0=1
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/60662.html
標籤:非技術區
上一篇:oracle 表空間添加資料檔案后,表空間利用率沒有下降
下一篇:order by 問題
