1 Answer
- Newest
- Most votes
- Most comments
0
【以下的回答经过翻译处理】 您好,我对上面的查询有一些更正。
- 包括Spot成本
- 有价格条款
- 除了计费成本外,还会存在摊销成本。如果客户提前购买了部分RI或SP,则这尤为重要。
- 如果包含摊销成本,则SQL条件中需要加上SavingsPlanNegation条件。
您仍然需要替换相同的名称。 您还应使用where子句重新限制时间范围。例如,要查找1月份的成本,您将编写:
where line_item_usage_state_date >= date '2021-01-01' and line_item_usage_state_date <date '2021-02-01' and
SELECT
line_item_usage_account_id
, (CASE WHEN (line_item_usage_type LIKE '%SpotUsage%') THEN 'Spot'
WHEN (((product_usagetype LIKE '%BoxUsage%') OR (product_usagetype LIKE '%DedicatedUsage:%')) AND ("line_item_line_item_type" LIKE 'SavingsPlanCoveredUsage')) or (line_item_line_item_type = 'SavingsPlanNegation') THEN 'SavingsPlan'
WHEN (("product_usagetype" LIKE '%BoxUsage%') AND ("line_item_line_item_type" LIKE 'DiscountedUsage')) THEN 'ReservedInstance'
WHEN ((("product_usagetype" LIKE '%BoxUsage%') OR ("product_usagetype" LIKE '%DedicatedUsage:%')) AND ("line_item_line_item_type" LIKE 'Usage')) THEN 'OnDemand'
ELSE 'Other' END) "价格条款"
, case when line_item_usage_type like '%BoxUsage' or line_item_usage_type like '%DedicatedUsage' then product_instance_type else split_part (line_item_usage_type, ':', 2) end InstanceType
, round (sum (line_item_unblended_cost),2) 计费成本
, round (sum((CASE
WHEN line_item_usage_type LIKE '%SpotUsage%' THEN line_item_unblended_cost
WHEN ((product_usagetype LIKE '%BoxUsage%') OR (product_usagetype LIKE '%DedicatedUsage:%')) AND (line_item_line_item_type LIKE 'Usage
Relevant content
- Accepted Answerasked 2 months ago
- asked a year ago
- asked a year ago
- AWS OFFICIALUpdated 5 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 months ago
- AWS OFFICIALUpdated 8 months ago