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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 sql every hour sales total by different shop

Author  Topic 

usafelix
Posting Yak Master

165 Posts

Posted - 2014-09-01 : 10:15:58
Anyone can review this query have any problem ?
I desire output by each hour of sales by different shop total with sales_datetime format is 20140831 22:30:xxx.

for example now is 23:05 then desire result is 23:00-23:05 of sale.
-----------------------------------------------------------------
select shopid,qty,amount from sales where sales_datetime>='hh:mm' and sales_datetime<='hh:mm' group by shop

gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2014-09-01 : 11:03:44
don't you need to SUM the sales?
Go to Top of Page

usafelix
Posting Yak Master

165 Posts

Posted - 2014-09-01 : 13:07:51
my desire of each hour of sales by different shop total sales amount,qty and sales_datetime format is 20140831 22:30:xxx
Go to Top of Page

gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2014-09-01 : 13:51:19
ok -- so lets see your query that does the totals!
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2014-09-02 : 03:03:58
see your other thread http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=195994



KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -