JAVA—咖啡館

          ——歡迎訪問rogerfan的博客,常來《JAVA——咖啡館》坐坐,喝杯濃香的咖啡,彼此探討一下JAVA技術(shù),交流工作經(jīng)驗,分享JAVA帶來的快樂!本網(wǎng)站部分轉(zhuǎn)載文章,如果有版權(quán)問題請與我聯(lián)系。

          BlogJava 首頁 新隨筆 聯(lián)系 聚合 管理
            447 Posts :: 145 Stories :: 368 Comments :: 0 Trackbacks

          當(dāng)月數(shù)據(jù)

          Sql代碼
          1. select * from table t   
          2. where t.create_time >=TRUNC(SYSDATE, 'MM')   
          3. and t.create_time<=last_day(SYSDATE)  
          select * from table t
          where t.create_time >=TRUNC(SYSDATE, 'MM')
          and t.create_time<=last_day(SYSDATE)


          當(dāng)年數(shù)據(jù)

          Sql代碼
          1. select * from table t   
          2. where t.create_time >=trunc(sysdate,'YYYY')   
          3. and t.create_time<=add_months(trunc(sysdate,'YYYY'),12)-1  
          select * from table t
          where t.create_time >=trunc(sysdate,'YYYY')
          and t.create_time<=add_months(trunc(sysdate,'YYYY'),12)-1


          本周(國外周日為一個星期第一天)

          Sql代碼
          1. where t.create_time >=trunc(sysdate,'day')+1 and t.create_time<=trunc(sysdate,'day')+6   
          where t.create_time >=trunc(sysdate,'day')+1 and t.create_time<=trunc(sysdate,'day')+6


          本周(國內(nèi)周一為一個星期第一天)

          Sql代碼
          1. where t.create_time >=trunc(next_day(sysdate-8,1)+1) and t.create_time<=trunc(next_day(sysdate-8,1)+7)+1  

          posted on 2010-07-13 10:23 rogerfan 閱讀(440) 評論(0)  編輯  收藏 所屬分類: 【數(shù)據(jù)庫】
          主站蜘蛛池模板: 都匀市| 界首市| 临沭县| 子洲县| 渭南市| 独山县| 二连浩特市| 彩票| 新田县| 普兰县| 浮梁县| 临桂县| 华亭县| 南木林县| 荣成市| 蕲春县| 疏附县| 鄯善县| 平南县| 涟水县| 衢州市| 高台县| 揭阳市| 肥城市| 甘德县| 东乡县| 桑日县| 宁海县| 蓬安县| 司法| 宁津县| 永平县| 桃园市| 额济纳旗| 资中县| 神木县| 固原市| 吉木萨尔县| 阿拉善右旗| 东安县| 鲁山县|