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
 request a simple query for 24 hours.

Author  Topic 

usafelix
Posting Yak Master

165 Posts

Posted - 2014-08-29 : 11:40:30
Anyone can help write a query for this result and must be handle of 24 hours with yyyy-mm-dd date format by different shop total.

Shop Time_slot yesterday Amt, current Amt, Diff Amt, Sales Direction
Abc 21:00 $10 $50 +40 (+)
Abc 22:00 $10 $0 -10 (-)
Total $30 $50 -20

BBB 22:00 $100 $50 -50 (-)
BBB 23:00 $100 $50 -50 (-)
Total $200 $100 -100 (-)

bitsmed
Aged Yak Warrior

545 Posts

Posted - 2014-08-29 : 14:53:16
Looks very much like:
[url]http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=195873[/url]
[url]http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=195960[/url]
[url]http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=195956[/url]
Go to Top of Page
   

- Advertisement -