Ok I have a sql statement that returns 3 columns:
Salesperson, Customer they met with, number of times they have met with that customer
select owneridname, regardingobjectidname, count(*) as hits from appointment
where statecode = '1'
group by owneridname, regardingobjectidname
order by hits desc
What I am wanting to do...I want to be able to take the total number of "hits" for an appointment (the second column) and divide it by the total number of hits that are returned for the salesperson (regardless of customer).
This will allow me to see if someone is seeing a customer too much and neglecting other customers.
Below is a copy of a few results from the query above. I want to add a % column and divide hits by the sum() of all hits for that username
OnweridName Customer # of completed appointments
Phillip Crisp SPRING LAKE COUNTRY CLUB 21
Ivey Barber LINVILLE GOLF CLUB 18
Nick Willis RESERVE AT LAKE KEOWEE 17
Phillip Crisp QUAIL HOLLOW CC 15
Nick Willis HOLLY TREE COUNTRY CLUB 14
Nick Willis THORNBLADE CLUB INC. 13
Robert Hinton WILLOWHAVEN COUNTRY CLUB 12
Phillip Crisp LONGLEAF GOLF & COUNTRY CLUB 12