oracle 日期查詢

2021-05-31 23:12:42 字數 903 閱讀 8259

1. string  hql = "select substr(to_char(create_time,'yyyy-mm-dd hh24:mm:ss'),1,10),"

+ "count(createtime) from sitebean where to_char(createtime,'yyyy-mm-dd') >= to_char(to_date( '"

+ fdate

+ "' ,'yyyy-mm-dd'),'yyyy-mm-dd') and to_char(createtime,'yyyy-mm-dd') <= to_char(to_date( '"

+ tdate

+ "' ,'yyyy-mm-dd'),'yyyy-mm-dd') "

+ "group by substr(to_char(create_time,'yyyy-mm-dd hh24:mm:ss'),1,10) order by 1 desc";

2.delete from  dlog_site  where to_char(create_time, 'yyyy-mm-dd') between  '2011-10-10'  and  '2011-10-12'

3.select substr(to_char(create_time, 'yyyy-mm-dd hh24:mm:ss'), 1, 10),

count(create_time)

from dlog_site

where to_char(create_time, 'yyyy-mm-dd') between  '2011-10-10'  

and  '2011-10-12'

group by substr(to_char(create_time, 'yyyy-mm-dd hh24:mm:ss'), 1, 10)

order by 1 desc;

Oracle 日期查詢

例如 select from c where cdate to date 2010 10 14 14 00 00 yyyy mm dd hh24 mi ss select from mytable where to char install date,yyyymmdd 20050101 select...

oracle 查詢日期

查詢乙個季度的第一天 select trunc sysdate,q from dual 查詢乙個季度的最後一天 select add months trunc to date 2010 02 01 yyyy mm dd q 3 1 from dual 查詢當前日期以前3個小時的資料 select s...

Oracle日期區間查詢

有個需求 在表中查詢 2020年1月至今的所有的資料 但是提供的年份和月份是兩個字段 這裡使用 即可拼接 select distinct wa data.year wa data.month,wa data.month from wa data where wa data.year wa data....