Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
blackX
Posting Yak Master
102 Posts |
Posted - 2008-12-10 : 11:30:50
|
I need to see summary detail information but I dont want to ask for each specific week. This will be for a report in Crystal. Our week go from Tueday thru Monday. Basically I would supply a procedure with a start and end date and I would see the summary for each week. Can anyone give me anything to get me started?So if I supply the dates 11/25/2008 and 12/8/2008 I would something like11/25/2008 thru 12/1/2008Net Sales: 512,000 Deals sold: 6512/2/2008 thru 12/8/2008Net Sales: 482,000 Deals sold: 57 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-12-10 : 12:04:06
|
[code]SELECT DATEADD(wk,DATEDIFF(wk,0,datefield),0)+1,SUM(Salesfieldhere),COUNT(dealfieldhere)FROM TableWHERE datefield BETWEEN @Start AND @End+1GROUP BY DATEADD(wk,DATEDIFF(wk,0,datefield),0)+1[/code] |
 |
|
|
|
|