I have a table with the following columns with ten different network types and 60K account numbers.
Account_nbr,
Network_Type,
Brand_AWP,
Brand_Rxs,
Generic_Rxs,
Brand_Fee,
Generic_Fee,
Brand_Rate,
Generic_Rate
I need to do the following:
Sum the AWP and RXS by Network_type so I can get a few weighted percentages. I tried doing this with an update statement, and ran into the aggregates not allowed in updates. I didn't want to create views or tables but try & do the whole thing with select statements.
I only need to calculate stats on the table as a whole and I am looking for suggestions to do the following
1. Network Yield = BRAND_RATE * AWP/SUM(AWP) this is a percentage for each account number, but when all 60K of them are added, you will have one yield number.
2. Network Brand Fee = Brand_fee * Brand_Rxs/SUM(Brand_Rxs)
3. Network Generic Fee = Generic_fee * Generic_Rxs/SUM(Generic_Rxs)
4. Network Average Fee = (Brand_Fee + Generic_Fee)/Sum((Brand_Fee + Generic_Fee))
Any and all suggestions will be highly appreciated
Michael
Account_nbr,
Network_Type,
Brand_AWP,
Brand_Rxs,
Generic_Rxs,
Brand_Fee,
Generic_Fee,
Brand_Rate,
Generic_Rate
I need to do the following:
Sum the AWP and RXS by Network_type so I can get a few weighted percentages. I tried doing this with an update statement, and ran into the aggregates not allowed in updates. I didn't want to create views or tables but try & do the whole thing with select statements.
I only need to calculate stats on the table as a whole and I am looking for suggestions to do the following
1. Network Yield = BRAND_RATE * AWP/SUM(AWP) this is a percentage for each account number, but when all 60K of them are added, you will have one yield number.
2. Network Brand Fee = Brand_fee * Brand_Rxs/SUM(Brand_Rxs)
3. Network Generic Fee = Generic_fee * Generic_Rxs/SUM(Generic_Rxs)
4. Network Average Fee = (Brand_Fee + Generic_Fee)/Sum((Brand_Fee + Generic_Fee))
Any and all suggestions will be highly appreciated
Michael