表a:
dt aa
2009-10-30 5
2009-10-29 6
2009-10-28 7
2009-10-27 4
2009-10-26 5
2009-10-25 5
2009-10-24 7
2009-10-23 8
2009-10-22 5
2009-10-21 6
2009-10-20 7
2009-10-19 6
2009-10-18 8
2009-10-17 3
2009-10-16 2表b
dt bb
2009-10-27 2
2009-10-20 3
2009-10-16 2
怎样查出结果:
2009-10-30 5 2009-10-27 2
2009-10-29 6 2009-10-27 2
2009-10-28 7 2009-10-27 2
2009-10-27 4 2009-10-27 2
2009-10-26 5 2009-10-20 3
2009-10-25 5 2009-10-20 3
2009-10-24 7 2009-10-20 3
2009-10-23 8 2009-10-20 3
2009-10-22 5 2009-10-20 3
2009-10-21 6 2009-10-20 3
2009-10-20 7 2009-10-20 3
2009-10-19 6 2009-10-16 2
2009-10-18 8 2009-10-16 2
2009-10-17 3 2009-10-16 2
2009-10-16 2 2009-10-16 2
dt aa
2009-10-30 5
2009-10-29 6
2009-10-28 7
2009-10-27 4
2009-10-26 5
2009-10-25 5
2009-10-24 7
2009-10-23 8
2009-10-22 5
2009-10-21 6
2009-10-20 7
2009-10-19 6
2009-10-18 8
2009-10-17 3
2009-10-16 2表b
dt bb
2009-10-27 2
2009-10-20 3
2009-10-16 2
怎样查出结果:
2009-10-30 5 2009-10-27 2
2009-10-29 6 2009-10-27 2
2009-10-28 7 2009-10-27 2
2009-10-27 4 2009-10-27 2
2009-10-26 5 2009-10-20 3
2009-10-25 5 2009-10-20 3
2009-10-24 7 2009-10-20 3
2009-10-23 8 2009-10-20 3
2009-10-22 5 2009-10-20 3
2009-10-21 6 2009-10-20 3
2009-10-20 7 2009-10-20 3
2009-10-19 6 2009-10-16 2
2009-10-18 8 2009-10-16 2
2009-10-17 3 2009-10-16 2
2009-10-16 2 2009-10-16 2
解决方案 »
- 分析某单位、某问题、某时间段内各年度问题发生的个数
- 求助:一个单表查询SQL
- vs 连接oracle数据库
- 关于表空间和表的问题
- 刚颁布的《中国贫富标准线》,看看我们生活在哪个层次?
- 初学ORACLE,一个简单的存储过程写法,请指点!
- Clob的字段,我发现在不能用sql语句插入大于4000的字符
- [200分] 在线时时安装,现场安装。
- 请教:由于硬盘故障,数据全部毁灭,我换了一个硬盘,重装了Oracle8.17,请问如何将原先备份在磁带机上的数据恢复出来,最好能提供相关代
- Oracle9i的序列号 那位大哥能告诉我 感谢
- 向ORACLE中上传文件create directory总是出错
- DB触发器
from a, b
where a.dt - b.dt >= 0
order by b.dt desc, a.dt
select t.rq,t.id, row_number()over(order by t. rq) seq1 from biao1 t ) b1 ,
(select t.rq,t.id, row_number()over(order by t. rq) seq2 from biao2 t) b2
where b1.seq1=b2.seq2 这样试试
from a t1,b t2
where not exists(
select 1 from b
where abs(dt-a.dt)<abs(b.dt-a.dt))
from a t1,b t2
where not exists(
select 1 from b
where abs(dt-t1.dt) <abs(t2.dt-t1.dt))