这样的SQL语句在Ora中不好用,看看错在哪里了??

icerain0322 2003-09-29 03:32:03
select * from pool a where (a.pool_05='北京市' and a.pool_04 = (select top 1 pool_04 from pool b where b.pool_05='北京市' and b.pool_04<='2003-02-03' order by pool_04 desc))

...全文
36 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
beckhambobo 2003-09-29
  • 打赏
  • 举报
回复
select * from
(select * from pool where pool_05='北京市' and pool_04<='2003-02-03' order by pool_04 desc)
where rownum<=1
wangxian 2003-09-29
  • 打赏
  • 举报
回复
没有top函数 可以用rownum
HeavenHe 2003-09-29
  • 打赏
  • 举报
回复
没有top函数
HeavenHe 2003-09-29
  • 打赏
  • 举报
回复
oracle里面好像没有top这个函数
bobfang 2003-09-29
  • 打赏
  • 举报
回复
select *
from pool a
where a.pool_05='北京市'
and a.pool_04 = (select max(pool_04)
from pool b
where b.pool_05='北京市'
and b.pool_04<='2003-02-03')
icerain0322 2003-09-29
  • 打赏
  • 举报
回复
主要实现将每个地区,离给定日期最近的那条记录

17,377

社区成员

发帖
与我相关
我的任务
社区描述
Oracle 基础和管理
社区管理员
  • 基础和管理社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧