oracle中要查询数据中两个时间差等于48小时 语句怎么写

2025-03-07 10:41:57
推荐回答(4个)
回答1:

select * from 表 where (LRSJ-WFSJ)*24 >48如果LRSJ和WFSJ设计时不是日期型,那么需要做一次转换select * from 表 where (to_date(LRSJ,'yyyy-mm-dd hh24:mi:ss')-to_date(WFSJ,'yyyy-mm-dd hh24:mi:ss'))*24 >48

回答2:

48小时就是2天嘛!所以条件这么写 where time1-time2=2 select * from TIMETEST where time1-time2=2 刚才写的是正好相差48小时的!大于48小时的这样写就行了!select * from TIMETEST where time1-time2<2

回答3:

时间与时间直接相减 结果是差的天数WFSJ -LRSJ=2*24select (date1 - date2) * 24 from dual;

回答4:

select * from tab where lrsj>wfsj+48/24