posts - 325,  comments - 25,  trackbacks - 0
          表名:A
          時間字段:ddatetime(datetime類型)

          查詢2003-2004年6月7日-7月8日數據。

          select * from A where (extract(year from ddatetime) between 2003 and 2004)
          and (extract(month from ddatetime) between 6 and 7)
          and (extract(day from ddatetime) between 6 and 7)

          extract只能取到日。小時,或者到秒,需要to_char。

          查詢2003-2004年6月7日-7月8日12時到20時數據。

          select * from A where (extract(year from ddatetime) between 2003 and 2004)
          and (extract(month from ddatetime) between 6 and 7)
          and (extract(day from ddatetime) between 6 and 7) and (to_char(ddatetime,'HH24') between 12 and 20)

          以上查詢在oracle可運行。

          posted on 2009-01-22 22:21 長春語林科技 閱讀(1295) 評論(0)  編輯  收藏 所屬分類: oracle
          <2009年1月>
          28293031123
          45678910
          11121314151617
          18192021222324
          25262728293031
          1234567

           

          長春語林科技歡迎您!

          常用鏈接

          留言簿(6)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          相冊

          收藏夾

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 达日县| 延庆县| 偃师市| 威海市| 滁州市| 临西县| 鲁甸县| 乌兰察布市| 平潭县| 连山| 荆州市| 永清县| 宾川县| 鞍山市| 宁都县| 万盛区| 瑞金市| 渝中区| 清原| 礼泉县| 监利县| 松阳县| 海安县| 元氏县| 泽普县| 呼和浩特市| 赣榆县| 繁峙县| 酒泉市| 石屏县| 鄂州市| 营口市| 日土县| 万安县| 永吉县| 郁南县| 土默特左旗| 清丰县| 阿克苏市| 阳高县| 江口县|