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
 SQL Server 2012 Forums
 Transact-SQL (2012)
 Trimming Zero, grand total , aver GP query

Author  Topic 

usafelix
Posting Yak Master

165 Posts

Posted - 2014-08-12 : 23:20:51
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
Master Smack Fu Yak Hacker

1834 Posts

Posted - 2014-08-13 : 11:59:16
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

165 Posts

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

Bustaz Kool
Master Smack Fu Yak Hacker

1834 Posts

Posted - 2014-08-20 : 16:13:57
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
   

- Advertisement -