![]() |
一身肌肉的松球 · ORA-29279: SMTP ...· 1 月前 · |
![]() |
阳光的甜瓜 · OracleJDK vs Zulu JDK ...· 4 周前 · |
![]() |
霸气的小熊猫 · oracle字符串缓冲区太小的解决办法-便宜 ...· 3 周前 · |
![]() |
好帅的抽屉 · 使用存储过程、函数或打包的过程和函数轮询 ...· 2 周前 · |
![]() |
私奔的卤蛋 · oracle text类型· 2 周前 · |
![]() |
大力的弓箭 · SuppressLint Class ...· 1 月前 · |
![]() |
打酱油的豆浆 · 深圳市气候概况及四季特征-深圳市气象局(台)· 5 月前 · |
![]() |
旅途中的茄子 · 版本说明 | ThinkingData· 7 月前 · |
![]() |
活泼的水煮肉 · win10虚拟机怎么连接本机蓝牙 ...· 7 月前 · |
![]() |
快乐的大蒜 · Win10+RTX3060配置CUDA等深度 ...· 7 月前 · |
![]() |
私奔的卤蛋 · oracle text类型 2 周前 |
![]() |
打酱油的豆浆 · 深圳市气候概况及四季特征-深圳市气象局(台) 5 月前 |
![]() |
旅途中的茄子 · 版本说明 | ThinkingData 7 月前 |
首先假设你的表名叫做tablename,然后又一个字段记录了更新时间。
你要查询更新时间在前六天到前三天的数据。
select * from tablename
where updatedate > sysdate -6 and updatedate < sysdate -3
[/Quote]
谢谢
这样就是从6天前的0点到4天前的23:59:59秒
>=trunc(sysdate)-6 and <trunc(sysdate)-3
为什么要用trunc(sysdate)呢
因为当前时间一般不会正好是0点,比如当前是11点,-6就是6天前的11 点开始
具体是Where 时间字段>=to_date('2008-04-03 00:00:00','yyyy-mm-dd hh24:mi:ss')-6 AND 时间字段<=to_date('2008-04-03 00:00:00','yyyy-mm-dd hh24:mi:ss')-4
别的都一样的,其实Oracle时间格式只要转换一次就行了,跟别的条件一样的。
但是注意一下你的字段是否是日期型
你要查询更新时间在前六天到前三天的数据。
select * from tablename
where updatedate > sysdate -6 and updatedate < sysdate -3