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.
Author |
Topic |
usafelix
Posting Yak Master
165 Posts |
Posted - 2015-01-22 : 23:52:44
|
I have a table with 4 column in belowTotal amount = 1000salemancode1 = spacesalemancode2 = Staff-99salemancode3 = spacesalemancode4 = staff-88how I can write a one query statement to do this, we expect to count how many salemancode is not space and count the number of salesman toover the total amount.total amount / (no_of_saleman) as commissionthe result is 1000/ 2 the commission is $500. |
|
viggneshwar
Yak Posting Veteran
86 Posts |
Posted - 2015-01-23 : 04:48:06
|
select count(case when salesmancode = '' then null else salesmancode end)from tablenameRegardsViggneshwar A |
|
|
|
|
|