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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2006-07-14 : 08:57:33
|
| vick writes "I have query which returns select [dayname], [hour], count([hour]) as nooforders from (select datepart(hour, order_date) as [hour], datename(WEEKDAY, order_date) as [dayname]from [order]where order_date between '4/03/2006' and '4/05/2006' ) tempCount group by [dayname],[hour]order by [dayname],[hour]day hr nooforderMonday 1 1Monday 18 76Monday 19 72Monday 20 52Monday 21 40Monday 22 24Monday 23 21Tuesday 0 8Tuesday 1 3Tuesday 3 6Tuesday 4 9Tuesday 5 7Tuesday 6 27I would like to also print the subtotal of each day in a query how I can do it? means Monday total order is x like that I would appreciate your replyThanksVick" |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2006-07-14 : 09:03:37
|
| Do subtotals in the Front-End or use compute by clause !Harsh AthalyeIndia."Nothing is Impossible" |
 |
|
|
RyanRandall
Master Smack Fu Yak Hacker
1074 Posts |
Posted - 2006-07-17 : 07:41:10
|
Modify your query like this...select [dayname], [hour], count([hour]) as nooforders from (select datepart(hour, order_date) as [hour],datename(WEEKDAY, order_date) as [dayname]from [order]where order_date between '4/03/2006' and '4/05/2006' ) tempCount group by [dayname],[hour]order by [dayname],[hour]with rolluphaving grouping([dayname]) = 0order by [dayname], grouping([hour]), [hour] Ryan Randallwww.monsoonmalabar.com London-based IT consultancy Solutions are easy. Understanding the problem, now, that's the hard part. |
 |
|
|
|
|
|
|
|