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 |
usafelix
Posting Yak Master
165 Posts |
Posted - 2014-08-21 : 11:51:02
|
I'm trying to get revenue by hour in one table. I would like to get the following columns and sku is contain of '%baby or oil%' and the hour from morning at 8:00 am to 22:00 pm and time range in below: please help to write a sql query . 08:00 - 09:0009:00 - 10:0010:00 - 11:0011:00 - 12:0012:00 - 13:0021:00 - 22:00StoreID, TransactionDate, TransactionHour, sku, TotalSalesA shop 20140821 13:00-14:00 oil $100A shop 20140821 13:00-14:00 baby $100 Total $200B shop 20140821 15:00-16:00 kid baby $250B shop 20140821 21:00-22:00 skin oil $150 Total $400 |
|
viggneshwar
Yak Posting Veteran
86 Posts |
Posted - 2015-01-09 : 01:03:25
|
Group by Grouping Sets will give you the subtotalRegardsViggneshwar A |
|
|
|
|
|