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
 General SQL Server Forums
 New to SQL Server Programming
 Totaling of columns

Author  Topic 

wsilage
Yak Posting Veteran

82 Posts

Posted - 2014-09-11 : 12:09:44
I did a Union query and I have this now in a table called T_AXA_Closed_Claim

Type orderval CLaim Count charges
Total Closed Claims 1 1202 2190994.520000
Attempted Negotiations 2 842 1939784.720000
Negotiated Deals 3 167 813549.960000

I have this information into a Table now. I need to do a percentage from (Negotiated Deals/Attempted Negotiations). How can I do something like this in a query where the are in the same column?

gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2014-09-11 : 12:27:24
[code]
select max(case [type] when 'Attempted Negotiations' then charges end)
/ max(case [type] when 'Negotiated Deals' then charges end) as 'Negotiated Deals/Attempted Negotiations'
from T_AXA_Closed_Claim
[/code]
Go to Top of Page
   

- Advertisement -