标签: sql sql-server
如果我的日期范围是从下周五到周四,我如何获得确切的周数? 我用过这段代码
datepart(wk,t.date) as workweek
但周数不同,可能因为我想要的格式是周五到周四的下周。我希望有人能回答。 TIA!
答案 0 :(得分:0)
SET DATEFIRST 5; -- Set Friday as first day of the week Select datepart(wk,t.date) -1 as workweek From yourTable as t