SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 total and grand total query ?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

usafelix
Yak Posting Veteran

Hong Kong
86 Posts

Posted - 08/23/2014 :  07:41:25  Show Profile  Reply with Quote
date shop sku staff qty amt
0813 13:20 hk book david 2 50
0813 18:20 usa toy mary 1 15
0813 09:15 hk cake ken 3 350
0813 13:40 can toy mak 7 10

i want...
shop sku staff qty amt
0813 0915 hk cake ken 3 350
0813 13:20 hk book david 2 50
total : 5 qty $400
0813 13:40 can toy mak. 7 $ 10
total : 7qty $10
0813 18:20 usa toy mary 1 $10

total : 13 qty
grand total : 420

it is any easy way to write a simple query ?


SwePeso
Patron Saint of Lost Yaks

Sweden
30241 Posts

Posted - 08/23/2014 :  07:46:17  Show Profile  Visit SwePeso's Homepage  Reply with Quote
Have a look at Books Online (the SQL Server help file) for
GROUP BY and specifically

GROUP BY GROUPING SETS ((Shop, SKU), ())



Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000