求教!这个查询该怎么写? 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)); SQL拼接问题,就解决 oracle两次导入dmp文件会怎么样? 关于oracle视图查询的问题 怎么修改已经建好的表中某一列的TITLE内容 请教一个问题---关于oracle中的nvl函数 PL/SQL连接oracle10提示监听超时 如何判断时间是否有错误? 请高手帮忙该个错误!在线等!谢谢! Oracle简单SQL问题 关于oracle 配置的问题 难题,难 数据库迁移
可是你的答案不对,最起码你的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));