sql - How to avoid datepart to start from new week on year change -


i have sql query using weekly data. works fine when year changes stops week on 4 days or whatever , starts new week new year. dont want that. want keep working like before. idea of how force group datepart(week, ad.xdate)

select 'playing' activity  ,min(ad.xdate) xdate ,isnull(sum(t.timeperday),0) timeperday     alldates ad (nolock)  left join @test t on ad.xdate = t.date group datepart(week, ad.xdate)    order min(ad.xdate) option (maxrecursion 0) 

group     datediff(week, 0, ad.xdate) 

Comments

Popular posts from this blog

mysql - FireDac error 314 - but DLLs are in program directory -

git - How to list all releases of public repository with GitHub API V3 -

c++ - Getting C2512 "no default constructor" for `ClassA` error on the first parentheses of constructor for `ClassB`? -