money.transaction_payment_summary (view)
|
This is a database view, not a base table. It has no triggers, indexes, or FK constraints of its own. Querying this view may be more efficient than joining the underlying tables directly. |
Columns
| Column | Type | Nullable | Notes |
|---|---|---|---|
xact |
|
Yes |
|
last_payment_type |
|
Yes |
|
last_payment_note |
|
Yes |
|
last_payment_ts |
|
Yes |
|
total_paid |
|
Yes |
View Definition
SELECT payment_view.xact,
last(payment_view.payment_type) AS last_payment_type,
last(payment_view.note) AS last_payment_note,
max(payment_view.payment_ts) AS last_payment_ts,
sum(COALESCE(payment_view.amount, 0::numeric)) AS total_paid
FROM money.payment_view
WHERE payment_view.voided IS FALSE
GROUP BY payment_view.xact
ORDER BY (max(payment_view.payment_ts));