diff --git a/queries.js b/queries.js index 60c9fe5..1a4f485 100644 --- a/queries.js +++ b/queries.js @@ -186,8 +186,13 @@ WHERE LOWER(line_item_product_code) = LOWER('%productCode%') export const invoices = `select DISTINCT bill_invoice_id as invoiceId, - year, month -FROM ${process.env.ATHENA_CU_TABLE}`; + year, month, + SUM(line_item_unblended_cost) AS totalUnblendedCost, + SUM(line_item_blended_cost) AS totalBlendedCost +FROM ${process.env.ATHENA_CU_TABLE} +WHERE bill_invoice_id IS NOT NULL +GROUP BY bill_invoice_id, year, month +ORDER BY year DESC, month DESC;` export const invoiceById = `select DISTINCT bill_invoice_id as invoiceId, @@ -217,7 +222,7 @@ FROM ${process.env.ATHENA_CU_TABLE} WHERE bill_invoice_id = '%invoiceId%' AND LOWER(line_item_product_code) = LOWER('%productCode%');`; - export const invoiceByProductCodeUsage = ` +export const invoiceByProductCodeUsage = ` SELECT DISTINCT bill_invoice_id as invoiceId, year, month,