ORACLE 将一个库的部分值带条件插入到另外一个库
时间:2021-07-01 10:21:17
帮助过:3人阅读
into table1 t1
select CRMII.SEQ_HX_WRZGBD.NEXTVAL
as id,
--序列
zqdm
as gpbh,
--字段1
zqmc
as gpmc,
--字段2
syl_lj
as ljsyl,
--字段3
sysdate
as cjsj
--系统时间
from (
select SYL_LJ, zqmc, zqdm
from (
select zqmc, zqdm,
max(syl_lj)
as syl_lj
from (
select ZQMC, ZQDM, SYL_LJ
from TETG_CP_JG_TJGP
where TJRQ
between
to_number(to_char(sysdate - 100,
‘yyyymmdd‘))
and
to_number(to_char(sysdate, ‘yyyymmdd‘))
--修改函数
--and YTJCP_MC LIKE ‘%热点%‘ 模糊查询
and SYL_LJ
is not null)
group by (zqmc, zqdm))
--去重
order by SYL_LJ
desc)
--排序
where rownum
<= 3;
--返回条数
ORACLE 将一个库的部分值带条件插入到另外一个库
标签:完全 row nbsp sele like creat sys create class