求教!这个查询该怎么写? select a.startno,a.endno from hdb a,hdb b where a.endno-a.startno<b.endno-b.startno 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 谢谢楼上的回答。可是你的答案不对,最起码你的sql会产生迪卡尔积呀。 对于重复记录,可以用DISTINCT方法去除 ,如select DISTINCT a.startno,a.endno from hdb a,hdb b where a.endno-a.startno<b.endno-b.startno 上面算法有问题:select distinct a.startno,a.endno from hdb a,hdb b where a.rowid<>b.rowid and (b.endno>=a.startno and b.endno<=a.endno); 这里有求重复记录的最好算法。可以查出指定重复的列的记录http://www.oradb.net/sql/find0.htm select * from hdb x where exists (select 'x' from hdb where rowid != x.rowid and (startno between x.startno and x.endno or endno between x.startno and x.endno)); 怎么把序列(SEQUENCE)和时间戳结合? 请教oracle导出到sql server2005 多行变多列问题,(并非多行变一列,稍微有点不同)求高手,急。 Oracle数据库CPU占用100% 有什么类似sqlplus,但比sqlplus好用的软件吗? athlon 2500+ 为什么装不上Oracle9i.... 请问大虾 关于数据库和表的问题,谢谢!在线等待! 小弟刚装了ORACLE DEVELOPER,有一个很菜的问题。 这样写为什么不能运行啊 难题,难 数据库迁移
可是你的答案不对,最起码你的sql会产生迪卡尔积呀。
select DISTINCT a.startno,a.endno from hdb a,hdb b where a.endno-a.startno<b.endno-b.startno
http://www.oradb.net/sql/find0.htm
where exists (select 'x' from hdb
where rowid != x.rowid
and (startno between x.startno and x.endno
or endno between x.startno and x.endno));