oracle的sql语句能以最大日期作为查询条件吗?能的话怎么写

0123fr 2013-11-25 06:54:07
oracle的sql语句能以最大日期作为查询条件吗?能的话怎么写

打个比方 select * from user r where max(r.date)

大约是这个意思,知道的话麻烦写一条类似的sql语句,别只说思路 谢谢
...全文
654 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
select date  from user group by date having max(date)=(select max(date) from user)
CT_LXL 2013-11-25
  • 打赏
  • 举报
回复
引用 楼主 u012953023 的回复:
oracle的sql语句能以最大日期作为查询条件吗?能的话怎么写 打个比方 select * from user r where max(r.date) 大约是这个意思,知道的话麻烦写一条类似的sql语句,别只说思路 谢谢
如果你需要用MAX作为条件你可以选择嵌套子查询: 比如:查出table1中大于table2最大日期的数据 select * from table t1 where t1.date>(select max(t2.date) from table2)
  • 打赏
  • 举报
回复
select a.* from user a where not exists (select 1 from  user b where a.date < b.date)
  • 打赏
  • 举报
回复
不能,方法很多种
select * from (select r.*,rownum rn from user r order by r.date desc )where rn =1

17,090

社区成员

发帖
与我相关
我的任务
社区描述
Oracle开发相关技术讨论
社区管理员
  • 开发
  • Lucifer三思而后行
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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