sql Help need

Analytics

sql Help need

I have a table with following data:

carrier first_reason_cde first_qty second_reas_cde second_qty third_reas_cde third_qty
111 10 2 0 0 0 0
111 0 0 11 1 0 0
111 0 0 0 0 11 2
222 0 0 12 4 0 0
222 11 1 0 0 0 0
222 0 0 0 0 13 4
so on ----- --- --- --- -- ---- ---

Desired Output:

carrier first_reason_cde first_qty second_reas_cde second_qty third_reas_cde third_qty
111 10 2 11 1 11 2
222 11 1 12 4 13 4

---- ----------- -- ------------------

THANKS
SATYA

1 REPLY
Enthusiast

Re: sql Help need

Hi Satya,

Try with the following query…

Select carrier, sum(first_reason_cde), sum(first_qty), sum(second_reas_cde), sum(second_qty), sum(third_reas_cde), sum(third_qty) from table_name group by 1

Regards,
Balamurugan