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
 SQL Server 2012 Forums
 Transact-SQL (2012)
 Trimming Zero, grand total , aver GP query
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

usafelix
Posting Yak Master

Hong Kong
102 Posts

Posted - 08/12/2014 :  23:20:51  Show Profile  Reply with Quote
Urgent Help
I want write a query to get this below result. trimming zero, average GP and adding grand total. Thanks

Current result is
shop sales amount GP
A 100.00000 10.08
B 200.00000 20.06
C 300.0000 30.14

Expect result is :-
shop saleamount GP
A HK$ 1000 50%
B HK$ 200 10%
C HK$ 300 15%
Total HK$ 1500 (average GP% xxx)

Bustaz Kool
Flowing Fount of Yak Knowledge

USA
1754 Posts

Posted - 08/13/2014 :  11:59:16  Show Profile  Reply with Quote
How are you generating the GP Percentage value?



Too often we enjoy the comfort of opinion without the discomfort of thought. - John F. Kennedy
Go to Top of Page

usafelix
Posting Yak Master

Hong Kong
102 Posts

Posted - 08/15/2014 :  05:28:29  Show Profile  Reply with Quote
The GP is base on sum up all shop the GP% and divided to no of shop.
Go to Top of Page

Bustaz Kool
Flowing Fount of Yak Knowledge

USA
1754 Posts

Posted - 08/20/2014 :  16:13:57  Show Profile  Reply with Quote
How does 100 have a GP of 50%?



Too often we enjoy the comfort of opinion without the discomfort of thought. - John F. Kennedy
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