用户登录
用户注册

分享至

oracle-sql时间区间查询代码,精确到时分秒

  • 作者: 爱青柠没道理
  • 来源: 51数据库
  • 2021-07-03

自己要写一个时间区间条件查询的需求,自己收集出来的资料,供给大家参考!总共有2种方式.

第一种//我采用的

select * from t1 where 1=1 
and t1.validate_state='1' 
and t1.start_date >= to_date( #{startdate_start},'yyyy-mm-dd hh24:mi:ss') 
and t1.start_date <= to_date( #{startdate_end},'yyyy-mm-dd hh24:mi:ss')

第二种 between and

`select * from t1 where t1.start_date 
between 
to_date(‘2015-10-20 00:00:00’,’yyyy-mm-dd hh24:mi:ss’)

软件
前端设计
程序设计
Java相关