_oracle 日期区间写法

原创
2017/04/14 17:33
阅读数 195

            A ."CreateDate" BETWEEN TO_DATE (#{startDate}, 'yyyy-mm-dd ')
AND TO_DATE (#{endDate}, 'yyyy-mm-dd')

 

1. 日期区间写法

SELECT COL01, DOU01, DOU02
  FROM (SELECT B.MC AS COL01,
               SUM(A.involvedMoney) AS DOU02,
               COUNT(*) AS DOU01
          FROM CKB_MESSAGE A
         INNER JOIN MT_RULE B ON (A.TriggerType = TO_CHAR(B. ID))
         INNER JOIN CK01_YHRY Y ON (A.PersonID = Y.GH)
         WHERE TO_CHAR(A.CreateDate) >= '2017-04-01 00:00:00'
           AND TO_CHAR(A.CreateDate) < '2017-09-14 23:59:59'
         GROUP BY B.MC
         ORDER BY COUNT(*) DESC) T
 WHERE ROWNUM < 10

展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
在线直播报名
返回顶部
顶部