Thank you to Mike Rylander who proposed this solution to the problem with that particular view:
CREATE OR REPLACE VIEW money.transaction_billing_summary AS
SELECT DISTINCT xact, LAST_VALUE(billing_type) OVER w AS last_billing_type, LAST_VALUE(note) OVER w AS last_billing_note, MAX(billing_ts) OVER w AS last_billing_ts, SUM(COALESCE(amount,0)) OVER w AS total_owed
FROM money.billing
WHERE voided IS FALSE
WINDOW w AS (PARTITION BY xact ORDER BY billing_ts ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING);
As he mentioned, there are many others to convert to using window functions. I have identified a list:
Thank you to Mike Rylander who proposed this solution to the problem with that particular view:
CREATE OR REPLACE VIEW money.transacti on_billing_ summary AS
LAST_VALUE( billing_ type) OVER w AS last_billing_type,
LAST_VALUE( note) OVER w AS last_billing_note,
MAX(billing_ ts) OVER w AS last_billing_ts,
SUM(COALESCE( amount, 0)) OVER w AS total_owed
SELECT DISTINCT xact,
FROM money.billing
WHERE voided IS FALSE
WINDOW w AS (PARTITION BY xact ORDER BY billing_ts ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING);
As he mentioned, there are many others to convert to using window functions. I have identified a list:
-- money.billable_ xact_summary_ new xact_with_ void_summary transaction_ billing_ summary transaction_ billing_ type_summary transaction_ payment_ summary on_billing_ type_summary on_billing_ with_void_ summary on_payment_ summary on_payment_ with_void_ summary
-- money.billable_
-- money.open_
-- money.open_
-- money.open_
-- money.transacti
-- money.transacti
-- money.transacti
-- money.transacti
I'm not sure how involved changing all of those would be, but it sounds like project.