insert into tableA (col1, col2, col3)
select distinct col1, col2, col3
from tableB where col1 > 0
and not exists (select * from tableA
where col1 = tableB.col1
and col2 = tableB.col2)
--這樣应该可以的吧
select distinct col1, col2, col3
from tableB where col1 > 0
and not exists (select * from tableA
where col1 = tableB.col1
and col2 = tableB.col2)
--這樣应该可以的吧
解决方案 »
- 问个有深度的问题哈,关于Timestamp做主键的表,该表下面挂的有触发器,触发到另外的表时,精度变掉了
- 关于windows操作系统访问ibm aix 中oracle数据库问题
- oracle函数
- 提示:ORA-12704: 字符集不匹配
- 在oracle中怎么对大型字符串数据进行插入,比如long、clob等等,在线等急用
- 100分求sqlexpert3.2 for oracle 的下载地址和注册码?
- 救命呀!!!initialization or shutdown inprogress 错误如何解决 ,各位大虾帮帮忙把
- 请教查询的问题?
- 为什么会出错!!你能给我解释吗??
- 怎样更改oracle中date的格式类型?不要在sqlplus里用alter session那种方法。
- 如何在oracle下用一个表更新另一个表(急用!)
- oracle sql 外编辑器那个好?
第一步:
select * from tableA where col1 = tableB.col1 and col2 = tableB.col2
第二步:
select distinct col1, col2, col3
from tableB where col1 > 0
and not exists (select * from tableA
where col1 = tableB.col1
and col2 = tableB.col2)
第三步:
insert into tableA (col1, col2, col3)
select distinct col1, col2, col3 from tableB where col1 > 0
and not exists (select * from tableA
where tableA.col1 = tableB.col1
and tableA.col2 = tableB.col2)