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)站導航:
           
          主站蜘蛛池模板: 池州市| 曲水县| 桂阳县| 祁连县| 柳州市| 舞阳县| 德兴市| 临高县| 富平县| 定边县| 平果县| 娄底市| 辉县市| 通城县| 丰县| 永平县| 平和县| 陵水| 辉县市| 固原市| 稻城县| 江华| 平和县| 泌阳县| 玛多县| 鄂托克旗| 岐山县| 金平| 莫力| 黄石市| 江口县| 永胜县| 同心县| 苗栗县| 伊宁市| 琼海市| 东兴市| 澄江县| 海阳市| 舒兰市| 宕昌县|