posts - 82, comments - 269, trackbacks - 0, articles - 1
            BlogJava :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理

          MySQL查詢不含周末的五天前的日期

          Posted on 2007-10-26 20:26 itspy 閱讀(272) 評論(0)  編輯  收藏
          來源:http://database.ctocio.com.cn/askexperts/216/7618716.shtml?ticket=ST-1398-lQWKhI5ZqQLqVscF67h8

          select distinct
                 cust.fname
               , cust.lname
               , cust.phone
            from orders as o
          inner
            join customers as cust
              on cust.id = orders.cust_id
           where o.date_ordered =
                 date_sub( current_date
                         , interval
                 7 - 2 * floor(dayofweek(current_date)/7)
                   + floor((dayofweek(current_date)-2)/7)
                               day )
             and o.date_shipped is null

          只有注冊用戶登錄后才能發(fā)表評論。


          網(wǎng)站導航:
           
          主站蜘蛛池模板: 嘉祥县| 武城县| 济宁市| 雅安市| 东乌珠穆沁旗| 安远县| 南康市| 铜陵市| 方正县| 昌邑市| 扎兰屯市| 灌云县| 喀喇| 潮州市| 石台县| 呼和浩特市| 牡丹江市| 隆化县| 红原县| 陈巴尔虎旗| 门头沟区| 威信县| 行唐县| 辉县市| 滁州市| 都兰县| 三明市| 汶上县| 万山特区| 历史| 无锡市| 江都市| 高唐县| 阳新县| 会泽县| 贡觉县| 潮安县| 麻城市| 高邮市| 泊头市| 台北市|