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

javascript - Can Piwik report referrer in real time? -

asp.net - Google Drive Access: At least one client secrets (Installed or Web) should be set -

c# - How do I debug "System.DllNotFoundException: The specified procedure could not be found"? -