March 16, 2011 at 1:13 pm
I have 3 columns
1 column has date
2nd column has time
3rd column has sale_amount
I want to get the hourly sale in a day..
For ex...
15 march 07:00 20$
15 march 08:30 33$
15 march 08:45 12$
15 march 08:55 02$
.
.
15 march 19:30 41$
I want to make a report of sales per hour...
I want like this
15 march 07-09am 67$ (20+33+12+02)
Which query to specify?
Regards
Sushant
Regards
Sushant Kumar
MCTS,MCP
March 16, 2011 at 1:41 pm
Sky, 3 things.
1) How is 7-9AM a single hour? That's 2 hours.
2) You want to use a dateadd/datediff method to get each timestamp to be equivalent in a derived column.
3) You've been around long enough, you know how this works. Consumable DDL and sample data please. Check the first link in my signature if you need help... 😉
Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.
For better assistance in answering your questions[/url] | Forum Netiquette
For index/tuning help, follow these directions.[/url] |Tally Tables[/url]
Twitter: @AnyWayDBA
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply