select * from (
select id,dw,xm,'0' sign from tbname where ny='199607'
minus
select id,dw,xm,'0' sign from tbname where ny='199608')
union all(
select id,dw,xm,'1' sign from tbname where ny='199608'
minus
select id,dw,xm,'1' sign from tbname where ny='199607');
select id,dw,xm,'0' sign from tbname where ny='199607'
minus
select id,dw,xm,'0' sign from tbname where ny='199608')
union all(
select id,dw,xm,'1' sign from tbname where ny='199608'
minus
select id,dw,xm,'1' sign from tbname where ny='199607');
解决方案 »
- ORACLE ORA-12569:TNS:包校验和失败
- 求一条关于时间的sql
- oracle 导入 *.DMP 文件问题
- 如何写时间的详细存储过程
- oracle中使用dbms_lob包从文件中读出文本数据到数据库的clob字段出线乱码,怎么解决,代码如下:
- 求一按年龄段统计的SQL语句写法
- 小问题三个,自加一列,select sysdate,取字符的前几位或后几位
- ORA-00604: error occurred at recursive SQL level 1和ORA-00018: maximum number of sessions exceeded 是什么错误怎么解决 谢谢
- PL/SQL 求助
- oracle连接、登入问题
- 在windows下如何启动数据库?
- 约束问题。如何在LINUX下查询一个表的唯一约束内容。
insert into new_table(id,dw,xm,sign) select id,dw,xm,'0' from old_table where ny='199607' and xm not in select ny from old_table where ny='199608';
where ny > '199606'
and ny < '199609'
and xm not in (select xm from old_table where ny < '199607')insert into new_table(id,dw,xm,sign) select id,dw,xm,'0' from old_table
where ny < '199607'
and xm not in (select xm from old_table where ny > '199606' and ny < '199609')
select * from (
select id,dw,xm,'0' sign from tbname where ny='199607'
minus
select id,dw,xm,'0' sign from tbname where ny='199608')
union all(
select id,dw,xm,'1' sign from tbname where ny='199608'
minus
select id,dw,xm,'1' sign from tbname where ny='199607');
from old_table
where ny=199607
and xm not in (select xm from old_table where ny=199608)
union all
select id,dw,xm,1
from old_table
where ny=199608
and xm not in (select xm from old_table where ny=199607)这样应该没问题吧~~~~
where ny > '199606'
and ny < '199609'
and xm not in (select xm from table where ny < '199607')