This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
invoice.customer_id, | |
invoice_line_item.id invoice_line_item_id, | |
invoice_line_item.invoice_id invoice_id, | |
plan.id plan_id, | |
plan.amount actual_plan_amount, | |
plan.interval plan_interval, | |
CASE | |
WHEN plan.interval = "year" THEN | |
plan.amount/12 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TEMP FUNCTION | |
get_priority(txn_type string) | |
RETURNS int64 AS ( | |
IF | |
(txn_type LIKE '%DR%', | |
1, | |
0)); | |
CREATE TEMP FUNCTION | |
capitalize(str STRING) AS (( | |
SELECT |