现在的位置: 首页 > 综合 > 正文

oracle 日期查询

2013年10月16日 ⁄ 综合 ⁄ 共 831字 ⁄ 字号 评论关闭
30元程序员衣装优惠券,仅剩3天!点击领取

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;
         

30元程>序员衣装优惠券,仅剩3天!点击领取

抱歉!评论已关闭.