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

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

python - build a suggestions list using fuzzywuzzy -