Postgres SQL, as run
select provider_name as provider_name,
billing_period_start as billing_period_start,
billing_period_end as billing_period_end,
service_category as service_category,
service_name as service_name,
region_id as region_id,
region_name as region_name,
pricing_unit as pricing_unit,
sum(effective_cost) as total_effective_cost,
sum(pricing_quantity) as total_pricing_quantity
from focus.cost_and_usage
where billing_period_start >= $1::timestamptz
and billing_period_end <= $2::timestamptz
group by provider_name, billing_period_start, billing_period_end, service_category, service_name, region_id, region_name, pricing_unit
order by abs(sum(effective_cost)) desc nulls last, billing_period_start, provider_name, service_name, region_id
limit 500Parameters: $1 = billing_period_start, $2 = billing_period_end
Original FOCUS SQL
SELECT
ProviderName,
BillingPeriodStart,
BillingPeriodEnd,
ServiceCategory,
ServiceName,
RegionId,
RegionName,
PricingUnit,
SUM(EffectiveCost) AS TotalEffectiveCost,
SUM(PricingQuantity) AS TotalPricingQuantity
FROM focus_data_table
WHERE BillingPeriodStart >= ? AND BillingPeriodEnd <= ?
GROUP BY
ProviderName,
BillingPeriodStart,
BillingPeriodEnd,
ServiceCategory,
ServiceName,
RegionId,
RegionName,
PricingUnit