mysql和oorcale日期区间查询【含左右区间问题】
直接看样例↓
mysql:
-- 查询区间[2021-12-01,2021-12-03) SELECT * FROM b WHERE b.trigger_time >= '2021-12-01' AND b.trigger_time <= '2021-12-03' -- 查询区间[2021-12-01,2021-12-03] SELECT * FROM b WHERE to_days( b.trigger_time ) >= to_days( '2021-12-01' ) AND to_days( b.trigger_time ) <= to_days( '2021-12-03' )
orcale:
-- 查询区间[2021-12-01,2021-12-03) SELECT * FROM b WHERE b.trigger_time >= to_date( '2021-12-01', 'yyyy-MM-dd' ) AND b.trigger_time <= to_date( '2021-12-03', 'yyyy-MM-dd' ) -- 查询区间[2021-12-01,2021-12-03] SELECT * FROM b WHERE to_char( b.trigger_time, 'yyyy-MM-dd' ) >= '2021-12-01' AND to_char( b.trigger_time, 'yyyy-MM-dd' ) <= '2021-12-03'
以上就是mysql和oorcale日期区间查询【含左右区间问题】的全部内容