Skip to content

Commit

Permalink
Defining a date range on CTE to get the max date from the current month.
Browse files Browse the repository at this point in the history
  • Loading branch information
bacciotti committed Nov 11, 2024
1 parent 10f1492 commit 0dad2d6
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ cte_latest_values as (
AND product_productfamily LIKE '%Compute Instance%'
AND lineitem_resourceid != ''
AND lineitem_usagestartdate = (
SELECT max(date(lv.lineitem_usagestartdate)) as usage_start from hive.{{schema | sqlsafe}}.aws_line_items_daily as lv
SELECT max(date(lv.lineitem_usagestartdate)) AS usage_start
FROM hive.{{schema | sqlsafe}}.aws_line_items_daily AS lv
WHERE year = '{{year | sqlsafe}}'
AND month = '{{month | sqlsafe}}'
)
GROUP BY
lineitem_resourceid,
Expand Down

0 comments on commit 0dad2d6

Please sign in to comment.