Sum of Column_B for each distinct Column_A

Database

Sum of Column_B for each distinct Column_A

How do I take a sum of one column (exposures) if and only if another column (ID) is distinct?  Note that Exposure is a calculated field and will always be the same for a single ID.

I have a table that looks like this:

ID Exposure  Claims

A        1            50

A        1           100

A        1             5

B        .25        1000

C        1            10

C        1            100

C        1            500

C        1            252

Output: 2.25

Tags (1)
1 REPLY
Enthusiast

Re: Sum of Column_B for each distinct Column_A

Does it serve the functioanlity if it is:

select sum(sm) from

(select id,exposure sm from tabl1 group by 1,2) a

it brings 2.25