close
Joe出了一個新題目
將資料庫內容的日期分成周列出來
網路上先找到周的分法
寫成如下
2.將finish date分周
2.1範例
select datepart(week,'2014/10/16') - datepart(week,'2014/10/1')+1
select datepart(week,finishDate) - datepart(week,'2014/10/1')+1
from Maintenance
2.2將表格finish date分周列出
create view WK
AS select conductor,finishDate,(datepart(week,finishDate) - datepart(week,'2014/10/1')+1) wk
from Maintenance
where finishDate BETWEEN'2014-10-01'and'2014-10-31'
參考資料
http://zhidao.baidu.com/question/134902255888083285.html
全站熱搜
留言列表