re: #158 andres
Sorry for the delay in answering.
At least in MySQL, the function weekofyear gives you a convenient way to get the week. You can use it in a group by.
I’m using DATEPART to get the week number, but then sorting by the Datetime. Using SQL Server 2008 here.