Untitled
unknown
plain_text
a year ago
768 B
11
Indexable
with calc_groups as (
select
calculation_number,
sum(case when offer_status = 'SUCCESS' then 1 else 0 end) as success_count
from offer.offer o
where o.previous_policy_number is null
and o.calculation_date between '2024-12-01' and '2025-01-01'
group by calculation_number
),
stats_by_success as (
select
success_count as "Liczba udanych TU",
count(*) as total_calculations,
round((count(*)::numeric / (select count(*) from calc_groups)::numeric * 100), 2) as percentage
from calc_groups
group by success_count
)
select
"Liczba udanych TU",
total_calculations as "Liczba kalkulacji",
percentage as "Procent kalkulacji (%)"
from stats_by_success
order by "Liczba udanych TU" desc;Editor is loading...
Leave a Comment