MySQL Forums
Forum List  »  Microsoft SQL Server

Group by Week problem
Posted by: Gaurav Bembi
Date: July 27, 2011 11:57PM


I have a table “Customers” having these columns “ID”, “Name”, “Salary”, “Date”.

I want to make a query using which I can get the report for last 13 weeks.

Note: Week should be from Monday to Sunday and in output we need to show date on Sunday in Week column for every week

Output should be
Name Week Salary
A1 Sunday, 30 Jan,2011 10000
A2 Sunday, 06 Feb,2011 20000
A3 Sunday, 13 Feb,2011 30000
A4 Sunday, 20 Feb,2011 20000
A5 Sunday, 27 Feb,2011 50000
And so on…

Options: ReplyQuote

Written By
Group by Week problem
July 27, 2011 11:57PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.